当前位置: 首页 > 工具软件 > txt2tags > 使用案例 >

关于 pip has no attribute pep425tags 的解决

艾心远
2023-12-01

关于module pip has no attribute pep425tags的解决

网上给了许多方法,我把他汇总了一下,目前我在CSDN查到的方法大部分都不适用,至少对我这样的菜鸟,pip 20.x.y版本貌似又做了一些改变。

问题分析

出现这个问题的原因在于版本,因为pip的版本问题所以之前的两种方法失效了。

  1. win32
>>> import pip
>>> print(pip.pep425tags.get_supported())
[('cp37', 'cp37m', 'win_amd64'), ('cp37', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp37', 'none', 'any'), ('cp3', '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')]

2.amd64

>>> import pip._internal
>>> print(pip._internal.pep425tags.get_supported())
[('cp36', 'cp36m', 'win32'), ('cp36', 'none', 'win32'), ('py3', 'none', 'win32')
, ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py
3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', '
none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none'
, 'any')]

从我收集的一些情况来看,18.0以上的pip这两个是行不通的。

之后我又在网上找到了一个新的方法尝试也就是

>>>import wheel.pep425tags as w
>>>print(w.get_supported())

但我同样出现了报错

TypeError                        Traceback (most recent call last)
<ipython-input-68-8e93f974cfc5> in <module>
      1 import wheel.pep425tags as w
      2 
----> 3 print(w.get_supported())

TypeError: get_supported() missing 1 required positional argument: 'archive_root'

我发现因为版本的更新,貌似这个方法对于我这样的小白来说又不适用了。但比较幸运,我在stack overflow看到了pip 20.0.2以上适用的方法。

python -m pip debug --verbose
pip version: pip 20.1.1 from C:\Users\卿语\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip (python 3.8)
sys.version: 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]
sys.executable: C:\Users\卿语\AppData\Local\Programs\Python\Python38-32\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\卿语\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pip\_vendor\certifi\cacert.pem
pip._vendor.DEBUNDLED: False
vendored library versions:
  appdirs==1.4.3
  CacheControl==0.12.6
  colorama==0.4.3
  contextlib2==0.6.0.post1 (Unable to locate actual module version, using vendor.txt specified version)
  distlib==0.3.0
  distro==1.5.0 (Unable to locate actual module version, using vendor.txt specified version)
  html5lib==1.0.1
  ipaddress==1.0.23
  msgpack==1.0.0 (Unable to locate actual module version, using vendor.txt specified version)
  packaging==20.3
  pep517==0.8.2
  progress==1.5
  pyparsing==2.4.7
  requests==2.23.0
  certifi==2020.04.05.1
  chardet==3.0.4
  idna==2.9
  urllib3==1.25.8
  resolvelib==0.3.0
  retrying==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.14.0
  toml==0.10.0
  webencodings==0.5.1 (Unable to locate actual module version, using vendor.txt specified version)
Compatible tags: 30
  cp38-cp38-win32
  cp38-abi3-win32
  cp38-none-win32
  cp37-abi3-win32
  cp36-abi3-win32
  cp35-abi3-win32
  cp34-abi3-win32
  cp33-abi3-win32
  cp32-abi3-win32
  py38-none-win32
  py3-none-win32
  py37-none-win32
  py36-none-win32
  py35-none-win32
  py34-none-win32
  py33-none-win32
  py32-none-win32
  py31-none-win32
  py30-none-win32
  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

为了搞定XX is not a supported wheel on this platform,真的是太难了

链接: https://stackoverflow.com/questions/50248524/module-pip-has-no-attribute-pep425tags#comment87571845_50248524.

 类似资料: