我正在构建自己的Python安装程序,然后使用pip在其中安装一些软件包。我想为Cryptography之类的软件包使用预构建的二进制轮子。
在GNU / Linux上可以正常使用:它抓住了manylinux1滚轮,并且一切正常。
在MacOS上,它拒绝下载大多数版本的任何二进制文件。我已经添加了许多-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
添加到了configure行,现在我的Python报告了这一点:
>>> import distutils.util
>>> distutils.util.get_platform()
'macosx-10.6-intel'
但是,当我尝试安装时,仍然从pip收到完全相同的消息。
所以我想知道,有什么办法可以使我更了解情况,并准确地告诉我关于它们不喜欢的这些二进制软件包的内容,这使它说“不兼容”并跳过它们?
答案 0 :(得分:2)
由于来自@wim的提示,我找到了以下命令:
$ mypython
...
>>> from 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并成功了!
希望这些信息对其他人有帮助。
答案 1 :(得分:0)
关于标签,在最新版本的 pip 中,可以通过与当前运行的 Python 解释器兼容的完整列表进行操作。 debug
command:
$ 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
[...]