为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

www说 2021-12-21 10:41:33
我正在构建自己的 Python 安装,然后使用 pip 将一些包安装到其中。我想将预先构建的二进制轮用于诸如Cryptography 之类的包。蟒蛇 2.7.15 / 2.7.16点 19.0.3安装工具 40.8.0在 GNU/Linux 上运行正常:它抓住了 manylinux1 轮子,一切正常。在 MacOS 上,它拒绝下载大多数版本的任何二进制轮子。我-v为 pip添加了很多选项,但它所说的只是:$ 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要更多的信息,告诉我究竟是什么它不喜欢这些二进制包,是导致它说“不兼容”,并跳过它们?
查看完整描述

2 回答

?
蝴蝶刀刀

TA贡献1801条经验 获得超8个赞

我找到了这个命令:


$ mypython

  ...

>>> from setuptools.pep425tags import get_supported

>>> for t in get_supported(): print(str(t))

...

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


我没有特别喜欢 UCS4 的理由,所以我将我的 MacOS 版本切换到 UCS2 并且它起作用了!


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


查看完整回答
反对 回复 2021-12-21
?
慕的地8271018

TA贡献1796条经验 获得超4个赞

关于标签,在最新版本的pip 中,可以使用以下命令获得与当前运行的Python解释器兼容的完整列表:debug


$ path/to/pythonX.Y -m pip debug --verbose

WARNING: This command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice.

[...]

Compatible tags: 87

  cp38-cp38-manylinux2014_x86_64

  cp38-cp38-manylinux2010_x86_64

  cp38-cp38-manylinux1_x86_64

  cp38-cp38-linux_x86_64

  cp38-abi3-manylinux2014_x86_64

  cp38-abi3-manylinux2010_x86_64

  cp38-abi3-manylinux1_x86_64

  cp38-abi3-linux_x86_64

  cp38-none-manylinux2014_x86_64

  cp38-none-manylinux2010_x86_64

  cp38-none-manylinux1_x86_64

  cp38-none-linux_x86_64

  cp37-abi3-manylinux2014_x86_64

  cp37-abi3-manylinux2010_x86_64

  cp37-abi3-manylinux1_x86_64

  cp37-abi3-linux_x86_64

[...]


查看完整回答
反对 回复 2021-12-21
  • 2 回答
  • 0 关注
  • 382 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号