Mad*_*ist 6 python macos pip python-wheel python-packaging
我正在构建自己的 Python 安装,然后使用 pip 安装一些包。我想将预构建的二进制轮用于Cryptography等软件包。
在 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)
Run Code Online (Sandbox Code Playgroud)
我试图理解为什么这些特定版本可以但不是最新的,我唯一能看到的是这些版本有一个特定的x86_64
轮包,而后面的版本只有胖二进制intel
轮包。我的 Python 有一个包定义:
>>> import distutils.util
>>> distutils.util.get_platform()
'macosx-10.12-x86_64'
Run Code Online (Sandbox Code Playgroud)
所以我想知道是不是就是这样。我修改了我的 Python 构建以使用MACOSX_DEPLOYMENT_TARGET=10.6
并添加--enable-universalsdk=/ --with-universal-archs=intel
到配置行,现在我的 Python 报告如下:
>>> import distutils.util
>>> distutils.util.get_platform()
'macosx-10.6-intel'
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试安装时,我仍然从 pip 收到完全相同的消息。
所以我想知道,有什么方法可以让 pip 提供更多信息,并准确地告诉我它不喜欢的这些二进制包的情况,这导致它说“不兼容”并跳过它们?
感谢 @wim 的提示,我找到了这个命令:
$ mypython
...
>>> from setuptools.pep425tags import get_supported
>>> for t in get_supported(): print(str(t))
...
Run Code Online (Sandbox Code Playgroud)
这显示了用于匹配受支持的包的元组的完整列表。使用这些信息,我能够将其与 PyPI 下载进行比较,发现我已经构建了支持 UCS4(这在 Linux 上很常见)的 MacOS Python,其中相对较少的 PyPI 包为 MacOS 提供了广泛的 unicode 二进制轮。
我没有特别的理由更喜欢 UCS4,所以我将我的 MacOS 版本切换到 UCS2,它成功了!
希望这些信息对其他人有帮助。
关于标签,最新版本的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
[...]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2249 次 |
最近记录: |