模块“ pip”没有属性“ pep425tags”

Ali*_*ina 5 python pip python-wheel

当我尝试使用pip安装.whl时

它说:

在此平台上不受支持

为了解决这个问题,我搜索了互联网,并说我可以将其输入外壳

进口点 打印(pip.pep425tags.get_supported())

这样我就可以获得pip支持的文档和版本

但是,当我输入这些代码时,它说:

模块“ pip”没有属性“ pep425tags”

怎么了?

sin*_*roc 18

如果目标只是获取兼容标签列表,则使用当前版本的pip(例如20.0.2):

$ path/to/pythonX.Y -m pip debug --verbose
Run Code Online (Sandbox Code Playgroud)


And*_*sky 6

对于pip v10,请使用以下命令:

import pip._internal; print(pip._internal.pep425tags.get_supported())
Run Code Online (Sandbox Code Playgroud)


小智 5

这对我来说适用于Python 2.7(在使用该版本的virtualenv中):

import wheel.pep425tags

print(wheel.pep425tags.get_supported())
Run Code Online (Sandbox Code Playgroud)


小智 5

使用 Python 3.6.8 和 pip 19.1.1

python -c "import wheel.pep425tags as w print(w.get_supported())"

工作!

输出:

[('cp36', 'cp36m', 'win_amd64'), ('cp36', 'none', 'win_amd64'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('cp35', 'none', 'any'), ('cp34', 'none', 'any'), ('cp33', 'none', 'any'), ('cp32', 'none', 'any'), ('cp31', 'none', 'any'), ('cp30', 'none', 'any'), ('py3', 'none', 'win_amd64'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]
Run Code Online (Sandbox Code Playgroud)