-
使用pip安装python库
python安装库可以使用:pip install 库名称==版本号,比如 pip install numpy==1.16.6
也可以下载.whl文件进行安装,命令行下将地址切换到.whl所在的位置:pip install XXX.whl
python库下载地址:http://www.lfd.uci.edu/~gohlke/pythonlibs
下载的库文件名中的cp27代表python2.7
-
is not a supported wheel on this platform问题
pip安装.whl文件可能会报错:is not a supported wheel on this platform
有可能是文件名格式不对
打开python,输入import pip; print(pip.pep425tags.get_supported())可以获取到pip支持的文件名还有版本,显示如下:
>>import pip; print(pip.pep425tags.get_supported())
[('cp27', 'none', 'win32'), ('py2', 'none', 'win32'), ('cp27', 'none', 'any'), ('cp2', 'none', 'any'), ('cp26', 'none', 'any'), ('cp25', 'none', 'any'), ('cp24', 'none', 'any'), ('cp23', 'none', 'any'), ('cp22', 'none', 'any'), ('cp21', 'none', 'any'), ('cp20', 'none', 'any'), ('py27', 'none', 'any'), ('py2', 'none', 'any'), ('py26', 'none', 'any'), ('py25', 'none', 'any'), ('py24', 'none', 'any'), ('py23', 'none', 'any'), ('py22', 'none', 'any'), ('py21', 'none', 'any'), ('py20', 'none', 'any')]
我下载的numpy的库文件名是numpy-1.16.6-cp27-cp27m-win32.whl,因此,需要将库文件名改为numpy-1.16.6-cp27-none-win32.whl即可
-
’module‘ object has no attribute 'pep425tags'问题
在python中输入import pip; print(pip.pep425tags.get_supported())可能会报错:‘module’ object has no attribute 'pep425tags'
解决方法:命令替换为:import pip._internal;print(pip._internal.pep425tags.get_supported())即可
参考:
https://blog.youkuaiyun.com/Redboy_Crazy/article/details/83020270
https://blog.youkuaiyun.com/Cinderella___/article/details/83030134
当使用pip安装Python库遇到'is not a supported wheel on this platform'错误时,可能是因为文件名格式不正确。通过在Python环境中输入`import pip; print(pip.pep425tags.get_supported())`来查看pip支持的文件格式。例如,将numpy的whl文件名从numpy-1.16.6-cp27-cp27m-win32.whl更改为numpy-1.16.6-cp27-none-win32.whl即可解决问题。若提示'module' object has no attribute 'pep425tags',则需用`import pip._internal; print(pip._internal.pep425tags.get_supported())`代替。
4078

被折叠的 条评论
为什么被折叠?



