请选择 进入手机版 | 继续访问电脑版
查看: 1575|回复: 0

超级大坑:centos为甚,is not supported platform

[复制链接]

665

主题

1234

帖子

6561

积分

xdtech

Rank: 5Rank: 5

积分
6561
发表于 2020-11-17 12:01:54 | 显示全部楼层 |阅读模式
本帖最后由 shaoheshaohe 于 2020-11-17 12:03 编辑

安装whl文件出错

报:文件名.whl is not a supported wheel on this platform.
应该是pip不支持这个whl文件的缘故,网上找了几个方法,最终解决了问题,记录一下查看pip支持版本的方法。
import pip
print(pip.pep425tags.get_supported())
这个函数可以查看到安装的pip支持的文件名和版本。



但是,以上并没解决问题。
因为现在都是64位电脑。以上的方法却是32位。64的方案:

【新版本】 pip
64位的要在后面pip后面加上._internal.pep425tags,才可以。

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

[('cp36', 'cp36m', 'win32'), ('cp36', 'none', 'win32'), ('py3', 'none', 'win32'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')>>>

【老版本】 pip
64位的要在后面pip后面加上._internal,才可以。

>>> 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'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')>>>


注意:以下写法或报错:
>>> import pip
>>> print(pip._internal.pep425tags.get_supported())

也就是,import必须要到
pep425tags这一层。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表