gpt4 book ai didi

python - 如何让 pip 告诉我为什么它与 PyPI 二进制轮不匹配?

转载 作者:太空宇宙 更新时间:2023-11-04 02:02:44 27 4
gpt4 key购买 nike

我正在构建自己的 Python 安装,然后使用 pip 将一些包安装到其中。我想为 Cryptography 这样的包使用预构建的二进制轮.

  • python 2.7.15/2.7.16
  • pip 19.0.3
  • 安装工具 40.8.0

在 GNU/Linux 上工作正常:它捕获 manylinux1 轮子,一切工作正常。

在 MacOS 上,它拒绝下载大多数版本的任何二进制轮。我已经为 pip 添加了很多 -v 选项,但它只是说:

$ mypython -s -u -m pip install -v --only-binary 'cryptography' 'cryptography==2.6.1'
...
Skipping link https://files.pythonhosted.org/packages/.../cryptography-2.6.1-cp27-cp27m-macosx_10_6_intel.whl#sha256=... (from https://pypi.org/simple/cryptography/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*); it is not compatible with this Python
...
Could not find a version that satisfies the requirement cryptography==2.6.1 (from versions: 1.0.1, 1.0.2, 1.1, 1.1.1, 1.1.2, 1.2, 1.2.1, 1.2.2, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.7, 1.7.1, 1.8, 1.8.1, 1.8.2)

我试图理解为什么那些特定的版本可以但不是最新的,我唯一能看到的是那些版本有一个特定的 x86_64 轮包,而后面的只有拥有胖二进制 intel 轮包。我的 Python 有一个包定义:

>>> import distutils.util
>>> distutils.util.get_platform()
'macosx-10.12-x86_64'

所以我想知道是不是这样。我修改了我的 Python 构建以使用 MACOSX_DEPLOYMENT_TARGET=10.6 并将 --enable-universalsdk=/--with-universal-archs=intel 添加到配置行,现在我的Python 报告:

>>> import distutils.util
>>> distutils.util.get_platform()
'macosx-10.6-intel'

但是,当我尝试安装时,我仍然从 pip 收到完全相同的消息。

所以我想知道,有什么方法可以让 pip 提供更多信息,并确切地告诉我什么它不喜欢这些二进制包,这导致它说“不兼容”并跳过它们?

最佳答案

感谢@wim 的提示,我找到了这个命令:

$ mypython
...
>>> from setuptools.pep425tags import get_supported
>>> for t in get_supported(): print(str(t))
...

这显示了用于匹配支持包的元组的完整列表。使用此信息,我能够将其与 PyPI 下载进行比较,并发现我构建了支持 UCS4(这在 Linux 上很常见)的 MacOS Python,其中相对较少的 PyPI 包为 MacOS 提供了广泛的 unicode 二进制轮。

我没有特别喜欢 UCS4 的理由,所以我将我的 MacOS 版本切换到 UCS2,它成功了!

希望这些信息对其他人有所帮助。

关于python - 如何让 pip 告诉我为什么它与 PyPI 二进制轮不匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55406059/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com