简体   繁体   English

Pip安装和平台专用车轮

[英]Pip install and platform specific wheels

How does pip install select wheels to install? 如何pip 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? 假设我为不同的平台构建了多个轮子,并上传到PyPI pip install <package>自动安装与平台匹配的正确轮子吗?

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> ? 如果我构建一个Linux特定的轮子并上传到PyPI,并且Windows / Mac上的某个人试图通过运行pip install <package>来安装它,会发生什么?

PIP follows the PEP 425 Use recommendations ; PIP遵循PEP 425 使用建议 ; this stipulates how a binary distribution wheel is selected. 这规定了如何选择二元分配轮。

Specifically, pip install will only consider compatible wheels. 具体来说, pip install只考虑兼容的轮子。 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; 车轮也可以用于纯python项目,此时它们不再是平台特定的; 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. 如果项目使用可选的二进制组件,他们可以选择生成特定于平台的轮子(包括特定于Python ABI版本和平台的已编译二进制组件),以及排除可选编译组件的通用轮。 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! 然而,这并不是那么常见,因为万向轮比源分布更受欢迎!

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

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