原因:未使用正确版本的wheel。
要下载正确的wheel,首先要知道自己系统python的版本。
查看自己系统Python版本的方法,网上有很多教程,我试了几个都失败了,
比如:
import pip
print(pip.pep425tags.get_supported())
import pip._internal
print(pip._internal.pep425tags.get_supported())
后来找到一个成功的方法
python -m pip debug --verbose
结果如下
pip version: pip 22.1.2 from C:\Users\50371\anaconda3\envs\pytorch_env\lib\site-packages\pip (python 3.9)
sys.version: 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)]
sys.executable: C:\Users\50371\anaconda3\envs\pytorch_env\python.exe
sys.getdefaultencoding: utf-8
sys.getfilesystemencoding: utf-8
locale.getpreferredencoding: cp936
sys.platform: win32
sys.implementation:
name: cpython
'cert' config value: Not specified
REQUESTS_CA_BUNDLE: None
CURL_CA_BUNDLE: None
pip._vendor.certifi.where(): C:\Users\50371\anaconda3\envs\pytorch_env\lib\site-packages\pip\_vendor\certifi\cacert.pem
pip._vendor.DEBUNDLED: False
vendored library versions:
CacheControl==0.12.11
colorama==0.4.4
distlib==0.3.3
distro==1.7.0
html5lib==1.1
msgpack==1.0.3 (Unable to locate actual module version, using vendor.txt specified version)
packaging==21.3
pep517==0.12.0
platformdirs==2.5.2
pyparsing==3.0.8
requests==2.27.1
certifi==2021.10.08
chardet==4.0.0
idna==3.3
urllib3==1.26.9
rich==12.2.0 (Unable to locate actual module version, using vendor.txt specified version)
pygments==2.11.2
typing_extensions==4.2.0 (Unable to locate actual module version, using vendor.txt specified version)
resolvelib==0.8.1
setuptools==44.0.0 (Unable to locate actual module version, using vendor.txt specified version)
six==1.16.0
tenacity==8.0.1 (Unable to locate actual module version, using vendor.txt specified version)
tomli==2.0.1
webencodings==0.5.1 (Unable to locate actual module version, using vendor.txt specified version)
Compatible tags: 33
cp39-cp39-win_amd64
cp39-abi3-win_amd64
cp39-none-win_amd64
cp38-abi3-win_amd64
cp37-abi3-win_amd64
cp36-abi3-win_amd64
cp35-abi3-win_amd64
cp34-abi3-win_amd64
cp33-abi3-win_amd64
cp32-abi3-win_amd64
py39-none-win_amd64
py3-none-win_amd64
py38-none-win_amd64
py37-none-win_amd64
py36-none-win_amd64
py35-none-win_amd64
py34-none-win_amd64
py33-none-win_amd64
py32-none-win_amd64
py31-none-win_amd64
py30-none-win_amd64
cp39-none-any
py39-none-any
py3-none-any
py38-none-any
py37-none-any
py36-none-any
py35-none-any
py34-none-any
py33-none-any
py32-none-any
py31-none-any
py30-none-any
可见最高版本是cp39
但奇怪的是我又在base环境试了下,
结果却不一样
pip version: pip 22.1.2 from C:\Users\50371\anaconda3\lib\site-packages\pip (python 3.8)
sys.version: 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]
sys.executable: C:\Users\50371\anaconda3\python.exe
sys.getdefaultencoding: utf-8
sys.getfilesystemencoding: utf-8
locale.getpreferredencoding: cp936
sys.platform: win32
sys.implementation:
name: cpython
'cert' config value: Not specified
REQUESTS_CA_BUNDLE: None
CURL_CA_BUNDLE: None
pip._vendor.certifi.where(): C:\Users\50371\anaconda3\lib\site-packages\pip\_vendor\certifi\cacert.pem
pip._vendor.DEBUNDLED: False
vendored library versions:
CacheControl==0.12.11
colorama==0.4.4
distlib==0.3.3
distro==1.7.0
html5lib==1.1
msgpack==1.0.3 (Unable to locate actual module version, using vendor.txt specified version)
packaging==21.3
pep517==0.12.0
platformdirs==2.5.2
pyparsing==3.0.8
requests==2.27.1
certifi==2021.10.08
chardet==4.0.0
idna==3.3
urllib3==1.26.9
rich==12.2.0 (Unable to locate actual module version, using vendor.txt specified version)
pygments==2.11.2
typing_extensions==4.2.0 (Unable to locate actual module version, using vendor.txt specified version)
resolvelib==0.8.1
setuptools==44.0.0 (Unable to locate actual module version, using vendor.txt specified version)
six==1.16.0
tenacity==8.0.1 (Unable to locate actual module version, using vendor.txt specified version)
tomli==2.0.1
webencodings==0.5.1 (Unable to locate actual module version, using vendor.txt specified version)
Compatible tags: 30
cp38-cp38-win_amd64
cp38-abi3-win_amd64
cp38-none-win_amd64
cp37-abi3-win_amd64
cp36-abi3-win_amd64
cp35-abi3-win_amd64
cp34-abi3-win_amd64
cp33-abi3-win_amd64
cp32-abi3-win_amd64
py38-none-win_amd64
py3-none-win_amd64
py37-none-win_amd64
py36-none-win_amd64
py35-none-win_amd64
py34-none-win_amd64
py33-none-win_amd64
py32-none-win_amd64
py31-none-win_amd64
py30-none-win_amd64
cp38-none-any
py38-none-any
py3-none-any
py37-none-any
py36-none-any
py35-none-any
py34-none-any
py33-none-any
py32-none-any
py31-none-any
py30-none-any
最高版本是cp3.8。
可是我电脑上明明只安装了python3.9啊.......
迷惑.....