问题
Let's say that I have two machines.
macOS 10.13 with internet connection
macOS 10.12 with no network connection
I want to install readline (for example) via a wheel.
I can grab the wheel easily enough with:
pip wheel -w . readline
and what I get is:
readline-6.2.4.1-cp36-cp36m-macosx_10_13_x86_64.whl
however, when I take this wheel over the the 10.12 machine and try to install it with:
pip install --no-index --find-links . readline
it will not install because the filename is tagged with 10.13.
Now, of course, the situation could be made a bit more complicated when either the internet connected machine or the offline machine is running Ubuntu.
Is there a way to ask pip for a particular wheel for a particular target OS?
Is the standard way of handling this to run 'pip wheel -w . readline' on the OS for the OS on which it will ultimately be installed?
回答1:
Is the standard way of handling this to run 'pip wheel' on the OS for the OS on which it will ultimately be installed?
Yes. People who release binary packages for a lot of architectures run a fleet of virtual machines or containers with a lot of emulated processor architectures and OSes.
For free software you can use free tiers on commercial CIs. At Travis CI you can generate wheels for Linux and Mac OS X, at AppVeyor for w32.
See https://pypi.python.org/pypi/cibuildwheel and https://github.com/matthew-brett/multibuild for example of programs that help to build wheels for different platforms.
来源:https://stackoverflow.com/questions/49635600/distributing-python-packages-to-offline-machines