简体   繁体   English

如何通过pip下载跨平台的轮子?

[英]How to download cross-platform wheels via pip?

I'm accustomed to pre-downloading packages using Pip, then copying them over to a target machine for deployment. 我习惯于使用Pip预下载软件包,然后将其复制到目标计算机上进行部署。 With the newly introduced Python Wheels, I'm forced to "pip ... --no-use-wheel", as some of the downloaded packages are platform specific (I'm developing on OSX and deploying to Debian) and will not install on the target machine. 使用新引入的Python Wheels,由于某些下载的软件包是特定于平台的(我正在OSX上开发并部署到Debian),因此我不得不“点子... --no-use-wheel”安装在目标计算机上。 Is there a way to download Wheels for target platforms (or platform independent)? 是否可以下载适用于目标平台(或与平台无关)的Wheels?

pip download命令现在具有--platform参数,您可以使用它来指定所需的平台:

pip download --platform=manylinux1_x86_64 --only-binary=:all: lxml

The easiest way to achieve that is IMO to use a custom script. 最简单的方法是IMO使用自定义脚本。

You can access the whole of the PyPI index via the simple interface, if the package of interest offers one or more wheels, they will be listed at the same address + /<package-name> . 您可以通过简单的界面访问整个PyPI索引,如果感兴趣的包提供一个或多个轮子,它们将在相同的地址+ /<package-name>处列出。

For example: if you were to install setuptools all wheels would be listed at: https://pypi.python.org/simple/setuptools/ 例如:如果要安装setuptools所有轮子都将在以下位置列出: https : setuptools

In your script, remember to implement the recommended tag priority as specified by PEP-425 . 在脚本中,请记住实现PEP-425指定的建议标签优先级。 Essentially that boils down to download the most specific (as opposed to the most general) version of the package as this normally translate into performance advantages, with for example C extensions replacing pure python implementations of some algorithm. 从本质上讲,这可以归结为下载软件包的最特定(而不是最通用)版本,因为这通常可以转化为性能优势,例如C扩展替换了某些算法的纯python实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM