天天看點

Python 技術篇-whl包安裝失敗規範命名執行個體示範,whl is not a supported wheel on this platform問題解決辦法

whl is not a supported wheel on this platform

就是說 whl 名的命名不符合它給的規範。

我們首先來檢視它的支援:

32 位檢視方法:

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

64 位檢視方法:

要在 pip 後加一個

._internal

,不然查不到。

更詳細的 pip 庫檢視方法檢視
>>> 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')]
>>>      

下面來舉個例子:

支援裡有個:

('cp36', 'none', 'win32')

我下的 whl 名字是:

PyHook3-1.6.1-cp35-cp35m-win32

安裝不了,

我改為:

PyHook3-1.6.1-cp36-none-win32

就好了,看後面 3 個正好是比對的。

注: 當然因為 python3.5 和 3.6 一般都是通用的,是以我改了也能用,如果是 python2.7 的,很可能庫裡存在相容性問題,即使我改了,用的時候也會報錯。當然,如果你很厲害的話,可以把庫的代碼不相容的地方也改了,當然也可以用。

喜歡的點個贊❤吧!