【转】查看python支持whl名称的方法

背景

今天在给树莓配安装tensorflow的时候,提示tensorflow-2.0.0-cp37-none-linux_armv7l.whl is not a supported wheel on this platform。
出现这个问题,是由于这个whl和系统python版本不匹配导致的。这个时候,需要我们找到当前python版本需要的whl命名格式,网上有不少教程提供了查看python支持whl名称的方法。
然而,网上的教程非常老旧,按照网上教程操作后,会提示pip has no attribute pep425tags。经过我多次搜集资料和尝试,总算找到了在pip 20.0等版本上可用的命令!

 

经测试有效的命令

我们可以通过下面这个经过测试有效的命令,来查看当前Python版本匹配那些文件。
有效命令如下(直接在命令行中输入,不要在Python解释器输入哦):

pip debug --verbose

输入这个命令后,会输出大量信息:

pip version: pip 20.1.1 from /home/pi/Softwares/venv3/lib/python3.7/site-packages/pip (python 3.7)
sys.version: 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0]
sys.executable: /home/pi/Softwares/venv3/bin/python
sys.getdefaultencoding: utf-8
sys.getfilesystemencoding: utf-8
locale.getpreferredencoding: UTF-8
sys.platform: linux
sys.implementation:
name: cpython
‘cert’ config value: global
REQUESTS_CA_BUNDLE: None
CURL_CA_BUNDLE: None
pip._vendor.certifi.where(): /home/pi/Softwares/venv3/lib/python3.7/site-packages/pip/_vendor/certifi/cacert.pem
pip._vendor.DEBUNDLED: False
vendored library versions:
appdirs1.4.3
CacheControl0.12.6
colorama0.4.3
contextlib20.6.0.post1 (Unable to locate actual module version, using vendor.txt specified version)
distlib0.3.0
distro1.5.0 (Unable to locate actual module version, using vendor.txt specified version)
html5lib1.0.1
ipaddress1.0.23
msgpack1.0.0 (Unable to locate actual module version, using vendor.txt specified version)
packaging20.3
pep5170.8.2
progress1.5
pyparsing2.4.7
requests2.23.0
certifi2020.04.05.1
chardet3.0.4
idna2.9
urllib31.25.8
resolvelib0.3.0
retrying1.3.3 (Unable to locate actual module version, using vendor.txt specified version)
setuptools44.0.0 (Unable to locate actual module version, using vendor.txt specified version)
six1.14.0
toml0.10.0
webencodings0.5.1 (Unable to locate actual module version, using vendor.txt specified version)
Compatible tags: 44
cp37-cp37m-manylinux2014_armv7l
cp37-cp37m-linux_armv7l
cp37-abi3-manylinux2014_armv7l
cp37-abi3-linux_armv7l
cp37-none-manylinux2014_armv7l
cp37-none-linux_armv7l
cp36-abi3-manylinux2014_armv7l
cp36-abi3-linux_armv7l
cp35-abi3-manylinux2014_armv7l
cp35-abi3-linux_armv7l
cp34-abi3-manylinux2014_armv7l
cp34-abi3-linux_armv7l
cp33-abi3-manylinux2014_armv7l
cp33-abi3-linux_armv7l
cp32-abi3-manylinux2014_armv7l
cp32-abi3-linux_armv7l
py37-none-manylinux2014_armv7l
py37-none-linux_armv7l
py3-none-manylinux2014_armv7l
py3-none-linux_armv7l
py36-none-manylinux2014_armv7l
py36-none-linux_armv7l
py35-none-manylinux2014_armv7l
py35-none-linux_armv7l
py34-none-manylinux2014_armv7l
py34-none-linux_armv7l
py33-none-manylinux2014_armv7l
py33-none-linux_armv7l
py32-none-manylinux2014_armv7l
py32-none-linux_armv7l
py31-none-manylinux2014_armv7l
py31-none-linux_armv7l
py30-none-manylinux2014_armv7l
py30-none-linux_armv7l
cp37-none-any
py37-none-any
py3-none-any
py36-none-any
py35-none-any
py34-none-any
py33-none-any
py32-none-any
py31-none-any
py30-none-any

从中我们可以看到Compatible tags字样,这些就是当前Python版本可以适配的标签。例如,我的Python版本是3.7.3,可以匹配下面这些文件名:

Compatible tags: 44
cp37-cp37m-manylinux2014_armv7l
cp37-cp37m-linux_armv7l
cp37-abi3-manylinux2014_armv7l
cp37-abi3-linux_armv7l
cp37-none-manylinux2014_armv7l
cp37-none-linux_armv7l
cp36-abi3-manylinux2014_armv7l
cp36-abi3-linux_armv7l
cp35-abi3-manylinux2014_armv7l
cp35-abi3-linux_armv7l
cp34-abi3-manylinux2014_armv7l
cp34-abi3-linux_armv7l
cp33-abi3-manylinux2014_armv7l
cp33-abi3-linux_armv7l
cp32-abi3-manylinux2014_armv7l
cp32-abi3-linux_armv7l
py37-none-manylinux2014_armv7l
py37-none-linux_armv7l
py3-none-manylinux2014_armv7l
py3-none-linux_armv7l
py36-none-manylinux2014_armv7l
py36-none-linux_armv7l
py35-none-manylinux2014_armv7l
py35-none-linux_armv7l
py34-none-manylinux2014_armv7l
py34-none-linux_armv7l
py33-none-manylinux2014_armv7l
py33-none-linux_armv7l
py32-none-manylinux2014_armv7l
py32-none-linux_armv7l
py31-none-manylinux2014_armv7l
py31-none-linux_armv7l
py30-none-manylinux2014_armv7l
py30-none-linux_armv7l
cp37-none-any
py37-none-any
py3-none-any
py36-none-any
py35-none-any
py34-none-any
py33-none-any
py32-none-any
py31-none-any
py30-none-any

这是真正解决了网上旧教程无效的问题。适用于pip 20.0等新版本的pip。

注意

之前旧版本的无效方法是Python语句,而此次有效命令则是pip命令,直接在命令行中输入,不要在Python解释器中输入哦
在找到python支持的标签后,就去下载对应的版本来安装吧~

 

 

posted @ 2022-03-04 16:27  _Ackerman  阅读(1642)  评论(0编辑  收藏  举报