pip install .whl文件時is not a supported wheel on this platform.解決方法

 首先,在python中輸入import pip和print(pip.pep425tags.get_supported()),從而獲取pip支持的文件名和版本。python

somnus@somnus-HP-Pavilion-Notebook:~$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> print(pip.pep425tags.get_supported())
[('cp27', 'cp27mu', 'manylinux1_x86_64'), ('cp27', 'cp27mu', 'linux_x86_64'), ('cp27', 'none', 'manylinux1_x86_64'), ('cp27', 'none', 'linux_x86_64'), ('py2', 'none', 'manylinux1_x86_64'), ('py2', 'none', 'linux_x86_64'), ('cp27', 'none', 'any'), ('cp2', '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')]

 而後,選擇支持的.whl文件下載便可,以下圖,因爲支持('cp27', 'cp27mu', 'manylinux1_x86_64'),因此可下載opencv_python-3.4.3.18-cp27-cp27mu-manylinux1_x86_64.whl。linux

PS:上述方法有時會報錯:bash

>>> import pip
>>> print(pip.pep425tags.get_supported())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'pep425tags'

此時,對於python2.7,可採用:python2.7

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

解決方案參考:https://stackoverflow.com/questions/50248524/module-pip-has-no-attribute-pep425tagsspa

相關文章
相關標籤/搜索