将python软件包分发到离线计算机 [英] Distributing python packages to offline machines
问题描述
假设我有两台机器.
macOS 10.13 with internet connection
macOS 10.12 with no network connection
我想通过轮子安装readline(例如).
I want to install readline (for example) via a wheel.
我可以很容易地抓住方向盘:
I can grab the wheel easily enough with:
pip wheel -w . readline
我得到的是:
readline-6.2.4.1-cp36-cp36m-macosx_10_13_x86_64.whl
但是,当我将车轮移到10.12机器上并尝试通过以下方式进行安装时:
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
由于文件名带有10.13标记,因此无法安装.
it will not install because the filename is tagged with 10.13.
现在,当Internet连接的计算机或脱机的计算机运行Ubuntu时,情况当然会变得有些复杂.
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?
是处理'pip wheel -w的标准方法.操作系统上的readline"以了解最终将安装该操作系统的操作系统?
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?
推荐答案
处理此问题的标准方法是在最终要安装该操作系统的OS上运行"pip wheel"吗?
Is the standard way of handling this to run 'pip wheel' on the OS for the OS on which it will ultimately be installed?
是的.为许多体系结构发布二进制程序包的人运行着具有许多模拟处理器体系结构和OS的虚拟机或容器.
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.
对于免费软件,您可以在商业CI上使用免费层.在Travis CI上,您可以在AppVeyor for w32上为Linux和Mac OS X生成转轮.
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.
请参见 https://pypi.python.org/pypi/cibuildwheel 和 https://github.com/matthew-brett/multibuild 例如有助于构建车轮的程序用于不同的平台.
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.
这篇关于将python软件包分发到离线计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!