点安装和平台专用轮 [英] Pip install and platform specific wheels

查看:76
本文介绍了点安装和平台专用轮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pip install如何选择要安装的车轮?

How does pip install select wheels to install?

说我已经为不同的平台构建了多个轮子,并且将pip install <package>上传到PyPI会自动安装与平台匹配的正确轮子吗?

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?

如果仅构建了Linux专用转盘并将其上传到PyPI,并且Windows/Mac上有人尝试通过运行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>?

推荐答案

PIP遵循

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

具体来说,pip install仅考虑兼容 的滚轮.不会下载与其他平台兼容的车轮.

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.

车轮也可以为纯python 项目构建,这时它们不再是特定于平台的;这些被称为通用车轮.如果项目使用可选二进制组件,则可以选择生成特定于平台的转盘(包括特定于Python ABI版本和平台的已编译二进制组件)和不包含可选已编译组件的通用转盘. .如果当前平台没有兼容的二进制版本,则安装程序可以选择通用版本.但是,这并不是很普遍,因为万用轮比源分配器更受青睐!

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!

这篇关于点安装和平台专用轮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆