The same list of python libraries for Ubuntu and Windows

I have Windows and Ubuntu on my PC.
I usually work with Python on Ubuntu, but sometimes I need to compile my scripts into a Windows.exe file. For this, I need to have the same list of python libraries installed on Windows as on Ubuntu.

I tried to solve this problem with

  • pip freeze> requirements.txt
  • pip install -r requirements.txt

but the second operation causes errors in many libraries, such as apturl and, of course, unity-area - "Could not find blah blah blah." At the moment, I'm just installing all the necessary libraries manually, but it's boring.

What is the best way to "synchronize" the python library list between Win and Linux?



After some thoughts.
Okay, I have an idea along with this other question - is it possible to ignore all the "Could not be found" errors and move on to the next item in the list?

+4
source share
2 answers

Try to install one by one

Linux

xargs -a requirements.txt -n 1 pip install

Window

import sys
import pip

def install(package):
    pip.main(['install', package])

if __name__ == '__main__':
    with open(sys.argv[1]) as f:
        for line in f:
            install(line)

Found here

Also, as already mentioned, do not forget about system packages, pip + virtualenv in some cases does not play very well, and you need to use external tools.

, pip accel . , , .

, 0.9 pip-accel , , .

pip-accel cPython 2.6, 2.7, 3.4 3.5 PyPy (2.7). Ubuntu Linux (Travis CI), Microsoft Windows (AppVeyor). pip-accel UNIX (, Mac OS X).

+1

, python. pip freeze > requirements.txt , python. - python, python , python . virtualenv (apt-get install python-virtualenv Ubuntu - Windows) :

  • (virtualenv /path/to/env)
  • virtualenv (///env/bin/)
  • requirements.txt ( , python, , , )
  • pip install -r requirements.txt , . (python myscript.py)
  • 1,2 4 .

@vrs, , - apturl unity-scope ( Linux), python, , virutalenv .

+1

Source: https://habr.com/ru/post/1623474/


All Articles