简体   繁体   中英

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. 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. Is there a way to download Wheels for target platforms (or platform independent)?

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.

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> .

For example: if you were to install setuptools all wheels would be listed at: https://pypi.python.org/simple/setuptools/

In your script, remember to implement the recommended tag priority as specified by 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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