日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

Python 安装库文件 is not a supported wheel on this platform的解决方案

發布時間:2023/12/10 python 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Python 安装库文件 is not a supported wheel on this platform的解决方案 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Python 安裝庫文件 is not a supported wheel on this platform的解決辦法

  • 1 問題描述
  • 2 問題原因分析
  • 3 解決方案
    • 3.1 獲取pip支持的文件名和版本
    • 3.2 下載特定版本的庫
    • 3.3 安裝
  • 4 其他解決方案

1 問題描述

本人最近安裝python版的GDAL庫,下載的版本為GDAL-3.1.2-cp39-cp39-win_amd64.whl
CMD執行命令:pip install GDAL-3.1.2-cp39-cp39-win_amd64.whl
卻出現錯誤提示:
ERROR: GDAL-3.1.2-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.

E:\python\Lib\site-packages>pip install GDAL-3.1.2-cp39-cp39-win_amd64.whl ERROR: GDAL-3.1.2-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.

如下圖:

2 問題原因分析

出現這一問題的原因主要分為兩種:

  • 安裝的不是對應python版本的庫,下載的庫名中cp39代表python3.9,而我安裝的python版本是3.8.5。
  • 下載的是對應版本的庫,然后仍然提示不支持當前平臺。
  • 3 解決方案

    解決這類問題,要保證自己安裝的庫對應于安裝的python版本及當前平臺。

    3.1 獲取pip支持的文件名和版本

    在網上搜索到的查看pip支持的文件名和版本的命令及自己的運行結果(在自己的電腦上不可行)分別是:
    1
    執行:import pip;
    print(pip.pep425tags.get_supported())
    輸出:Traceback (most recent call last):
    File “<pyshell#0>”, line 1, in
    import pip; print(pip.pep425tags.get_supported())
    AttributeError: module ‘pip’ has no attribute 'pep425tags’

    >>> import pip; >>> print(pip.pep425tags.get_supported()) Traceback (most recent call last):File "<pyshell#0>", line 1, in <module>import pip; print(pip.pep425tags.get_supported()) AttributeError: module 'pip' has no attribute 'pep425tags'

    2
    執行:import pip._internal.pep425tags
    輸出:Traceback (most recent call last):
    File “<pyshell#1>”, line 1, in
    import pip._internal.pep425tags
    ModuleNotFoundError: No module named 'pip._internal.pep425tags’

    >>> import pip._internal.pep425tags Traceback (most recent call last):File "<pyshell#1>", line 1, in <module>import pip._internal.pep425tags ModuleNotFoundError: No module named 'pip._internal.pep425tags'

    3
    執行:import pip._internal; print(pip._internal.pep425tags.get_supported())
    輸出:Traceback (most recent call last):
    File “<pyshell#3>”, line 1, in
    print(pip._internal.pep425tags.get_supported())
    AttributeError: module ‘pip._internal’ has no attribute 'pep425tags’

    >>> import pip._internal >>> print(pip._internal.pep425tags.get_supported()) Traceback (most recent call last):File "<pyshell#3>", line 1, in <module>print(pip._internal.pep425tags.get_supported()) AttributeError: module 'pip._internal' has no attribute 'pep425tags'
  • 執行:import wheel.pep425tags as w
    輸出:Traceback (most recent call last):
    File “<pyshell#4>”, line 1, in
    import wheel.pep425tags as w
    ModuleNotFoundError: No module named 'wheel’

    >>> import wheel.pep425tags as w Traceback (most recent call last):File "<pyshell#4>", line 1, in <module>import wheel.pep425tags as w ModuleNotFoundError: No module named 'wheel'

    在我的電腦上可行的方法:
    5
    在CMD執行命令:python -m pip debug --verbose

    C:\Users\zy>python -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. pip version: pip 20.2.2 from E:\python\lib\site-packages\pip (python 3.8) sys.version: 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] sys.executable: E:\python\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(): E:\python\lib\site-packages\pip\_vendor\certifi\cacert.pem pip._vendor.DEBUNDLED: False vendored library versions:appdirs==1.4.4CacheControl==0.12.6colorama==0.4.3contextlib2==0.6.0.post1 (Unable to locate actual module version, using vendor.txt specified version)distlib==0.3.1distro==1.5.0 (Unable to locate actual module version, using vendor.txt specified version)html5lib==1.1ipaddress==1.0.23msgpack==1.0.0 (Unable to locate actual module version, using vendor.txt specified version)packaging==20.4pep517==0.8.2progress==1.5pyparsing==2.4.7requests==2.24.0certifi==2020.06.20chardet==3.0.4idna==2.10urllib3==1.25.9resolvelib==0.4.0retrying==1.3.3 (Unable to locate actual module version, using vendor.txt specified version)setuptools==44.0.0 (Unable to locate actual module version, using vendor.txt specified version)six==1.15.0toml==0.10.1webencodings==0.5.1 (Unable to locate actual module version, using vendor.txt specified version) Compatible tags: 30cp38-cp38-win_amd64cp38-abi3-win_amd64cp38-none-win_amd64cp37-abi3-win_amd64cp36-abi3-win_amd64cp35-abi3-win_amd64cp34-abi3-win_amd64cp33-abi3-win_amd64cp32-abi3-win_amd64py38-none-win_amd64py3-none-win_amd64py37-none-win_amd64py36-none-win_amd64py35-none-win_amd64py34-none-win_amd64py33-none-win_amd64py32-none-win_amd64py31-none-win_amd64py30-none-win_amd64cp38-none-anypy38-none-anypy3-none-anypy37-none-anypy36-none-anypy35-none-anypy34-none-anypy33-none-anypy32-none-anypy31-none-anypy30-none-any

    由此,可以看到自己電腦上pip支持的文件名和版本,最高版本為 cp38-cp38-win_amd64,而之前安裝的是cp39-cp39-win_amd64。

    3.2 下載特定版本的庫

    可以看到,我的pip支持cp38-cp38-win_amd64,恰好有這個版本的GDAL文件GDAL-3.1.2-cp38-cp38-win_amd64.whl
    于是下載該版本的文件

    3.3 安裝

    CMD執行命令:pip install GDAL-3.1.2-cp38-cp38-win_amd64.whl

    E:\python\Lib\site-packages>pip install GDAL-3.1.2-cp38-cp38-win_amd64.whl Processing e:\python\lib\site-packages\gdal-3.1.2-cp38-cp38-win_amd64.whl Installing collected packages: GDAL Successfully installed GDAL-3.1.2

    至此,成功安裝了python版本的GDAL庫。

    4 其他解決方案

    在看到自己電腦上pip支持的文件名和版本后,也有人說可以直接修改下載的文件名,但個人并不建議這樣做。

    總結

    以上是生活随笔為你收集整理的Python 安装库文件 is not a supported wheel on this platform的解决方案的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。