你下载安装的包不是当前平台所支持的
你下载的包,不符合你所在的平台的安装whl的名称规范,所以出错。
比如当前我要安装的包是:PyMuPDF-1.16.16-cp36-cp36m-manylinux2010_x86_64.whl
但是在我的系统中使用如下命令安装:
pip3 install PyMuPDF-1.16.11-cp36-cp36m-manylinux2010_x86_64.whl
但是出现了下面的错误提示:
PyMuPDF-1.16.11-cp36-cp36m-manylinux2010_x86_64.whl is not a supported wheel on this platform.
在shell中运行python,然后输入如下的命令:
>>import pip;print(pip.pep425tags.get_supported())
输出结果如下:
[('cp36', 'cp36m', 'manylinux1_x86_64'), ('cp36', 'cp36m', 'linux_x86_64'), ('cp36', 'abi3', 'manylinux1_x86_64'), ('cp36', 'abi3', 'linux_x86_64'), ('cp36', 'none', 'manylinux1_x86_64'), ('cp36', 'none', 'linux_x86_64'), ('cp35', 'abi3', 'manylinux1_x86_64'), ('cp35', 'abi3', 'linux_x86_64'), ('cp34', 'abi3', 'manylinux1_x86_64'), ('cp34', 'abi3', 'linux_x86_64'), ('cp33', 'abi3', 'manylinux1_x86_64'), ('cp33', 'abi3', 'linux_x86_64'), ('cp32', 'abi3', 'manylinux1_x86_64'), ('cp32', 'abi3', 'linux_x86_64'), ('py3', 'none', 'manylinux1_x86_64'), ('py3', 'none', 'linux_x86_64'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]
其中有一个('cp36', 'cp36m', 'manylinux1_x86_64')
意味着如果我要安装python3.6版本的whl,那么我的whl文件中应该是manylinux1_x86_64
而不是manylinux2010_x86_64
,所以我将文件名改成PyMuPDF-1.16.11-cp36-cp36m-manylinux1_x86_64.whl
,然后再进行安装,结果安装成功。
在方法1中,我们通过import pip;print(pip.pep425tags.get_supported())
得到文件支持的格式,但是这个命令应该只适用于低版本的pip,比如pip 9.0.1
.如果我们的系统是高版本的系统,可以使用下面的命令:
>>> import pip._internal.pep425tags;print(pip._internal.pep425tags.get_supported())
比如如果pip版本是pip 20.0.2
,那么得到的结果是:
[<cp36-cp36m-manylinux2014_x86_64 @ 140387595805896>, <cp36-cp36m-manylinux2010_x86_64 @ 140387594919752>, <cp36-cp36m-manylinux1_x86_64 @ 140387594919624>, <cp36-cp36m-linux_x86_64 @ 140387594919816>, <cp36-abi3-manylinux2014_x86_64 @ 140387594985544>, <cp36-abi3-manylinux2010_x86_64 @ 140387594985608>, <cp36-abi3-manylinux1_x86_64 @ 140387594985672>, <cp36-abi3-linux_x86_64 @ 140387594985736>, <cp36-none-manylinux2014_x86_64 @ 140387594985864>, <cp36-none-manylinux2010_x86_64 @ 140387594985928>, <cp36-none-manylinux1_x86_64 @ 140387594985992>, <cp36-none-linux_x86_64 @ 140387594986056>, <cp35-abi3-manylinux2014_x86_64 @ 140387594986184>, <cp35-abi3-manylinux2010_x86_64 @ 140387594986248>, <cp35-abi3-manylinux1_x86_64 @ 140387594986312>, <cp35-abi3-linux_x86_64 @ 140387594986376>, <cp34-abi3-manylinux2014_x86_64 @ 140387594986504>, <cp34-abi3-manylinux2010_x86_64 @ 140387594986568>, <cp34-abi3-manylinux1_x86_64 @ 140387594986632>, <cp34-abi3-linux_x86_64 @ 140387594986696>, <cp33-abi3-manylinux2014_x86_64 @ 140387594986824>, <cp33-abi3-manylinux2010_x86_64 @ 140387594986888>, <cp33-abi3-manylinux1_x86_64 @ 140387594986952>, <cp33-abi3-linux_x86_64 @ 140387594987016>, <cp32-abi3-manylinux2014_x86_64 @ 140387594987144>, <cp32-abi3-manylinux2010_x86_64 @ 140387594987208>, <cp32-abi3-manylinux1_x86_64 @ 140387594987272>, <cp32-abi3-linux_x86_64 @ 140387594987336>, <py36-none-manylinux2014_x86_64 @ 140387594987656>, <py36-none-manylinux2010_x86_64 @ 140387594987464>, <py36-none-manylinux1_x86_64 @ 140387594987592>, <py36-none-linux_x86_64 @ 140387594987720>, <py3-none-manylinux2014_x86_64 @ 140387594987848>, <py3-none-manylinux2010_x86_64 @ 140387594987912>, <py3-none-manylinux1_x86_64 @ 140387594987976>, <py3-none-linux_x86_64 @ 140387594988040>, <py35-none-manylinux2014_x86_64 @ 140387594988168>, <py35-none-manylinux2010_x86_64 @ 140387594988232>, <py35-none-manylinux1_x86_64 @ 140387594988296>, <py35-none-linux_x86_64 @ 140387594988360>, <py34-none-manylinux2014_x86_64 @ 140387594988488>, <py34-none-manylinux2010_x86_64 @ 140387594988552>, <py34-none-manylinux1_x86_64 @ 140387594988616>, <py34-none-linux_x86_64 @ 140387594988680>, <py33-none-manylinux2014_x86_64 @ 140387594988808>, <py33-none-manylinux2010_x86_64 @ 140387594988872>, <py33-none-manylinux1_x86_64 @ 140387594988936>, <py33-none-linux_x86_64 @ 140387594989000>, <py32-none-manylinux2014_x86_64 @ 140387594989128>, <py32-none-manylinux2010_x86_64 @ 140387594989192>, <py32-none-manylinux1_x86_64 @ 140387594989256>, <py32-none-linux_x86_64 @ 140387594989320>, <py31-none-manylinux2014_x86_64 @ 140387594989448>, <py31-none-manylinux2010_x86_64 @ 140387594989512>, <py31-none-manylinux1_x86_64 @ 140387594993736>, <py31-none-linux_x86_64 @ 140387594993800>, <py30-none-manylinux2014_x86_64 @ 140387594993928>, <py30-none-manylinux2010_x86_64 @ 140387594993992>, <py30-none-manylinux1_x86_64 @ 140387594994056>, <py30-none-linux_x86_64 @ 140387594994120>, <cp36-none-any @ 140387594994248>, <py36-none-any @ 140387594994312>, <py3-none-any @ 140387594994376>, <py35-none-any @ 140387594994440>, <py34-none-any @ 140387594994504>, <py33-none-any @ 140387594994568>, <py32-none-any @ 140387594994632>, <py31-none-any @ 140387594994696>, <py30-none-any @ 140387594994760>]
可以看见支持安装的版本一下子多了起来,所以第二种解决办法就是升级pip
,可以通过如下命令升级pip
:
python -m pip install --upgrade pip
通常情况下,你的电脑里如果安装了python2.x也同时安装了python3.x,那么应该就会有两个pip。一个是pip2,另一个是pip3。那么可以采用:
pip3 install --upgrade pip