module 'pip' has no attribute 'pep425tags'

夙愿已清 提交于 2020-01-10 04:06:10

问题


When I am trying to install .whl with pip

it said:

is not a supported wheel on this platform

to solve this problem, I searched the Internet and it said I can input this into shell

import pip; print(pip.pep425tags.get_supported())

with this I can get the documents and versions that pip supports

However, when I input these code, it said:

module 'pip' has no attribute 'pep425tags'

What's wrong?


回答1:


This worked for me with Python 2.7 (in a virtualenv using that version):

import wheel.pep425tags

print(wheel.pep425tags.get_supported())



回答2:


For pip v10 use this:

import pip._internal; print(pip._internal.pep425tags.get_supported())



回答3:


Using Python 3.6.8 and pip 19.1.1

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

worked!

Output:

[('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')]



回答4:


A bash one-liner, good for both Py2.7 & Py3.6 with pip-18.1:

python3 -c "import wheel.pep425tags as w; print(w.get_supported())" |sed -zE 's/\),/),\n/g'



回答5:


AMD64

import pip._internal;print(pip._internal.pep425tags.get_supported())

WIN32

import pip;print(pip.pep425tags.get_supported())

then pip install <.whl> by corresponding platform wheel(https://www.lfd.uci.edu/~gohlke/pythonlibs/)



来源:https://stackoverflow.com/questions/50248524/module-pip-has-no-attribute-pep425tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!