Pip install and platform specific wheels

孤者浪人 提交于 2019-12-23 18:59:15

问题


How does pip install select wheels to install?

Say I've built multiple wheels for different platforms, and upload to PyPI does pip install <package> automatically install the correct wheel that matches the platform?

What happens if I've built a Linux specific wheel only and upload to PyPI, and someone on Windows/Mac trying to install it by running pip install <package>?


回答1:


PIP follows the PEP 425 Use recommendations; this stipulates how a binary distribution wheel is selected.

Specifically, pip install will only consider compatible wheels. A wheel compatible with a different platform is not going to be downloaded.

If there are no compatible wheels, but there is a source distribution, then that source distribution is downloaded and compiled locally. If there are no compatible wheels, and no source distribution, installation fails.

Wheels can also be built for pure python projects, at which point they are no longer platform specific; these are called universal wheels. If a project uses optional binary components they can choose to produce both platform-specific wheels (including the compiled binary components specific to a Python ABI version and platform), and a universal wheel with the optional compiled components excluded. An installer can then select the universal version if no compatible binary version is available for the current platform. This is not all that common however, as a universal wheel would be preferred over a source distribution!



来源:https://stackoverflow.com/questions/51527148/pip-install-and-platform-specific-wheels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!