本文講述了Python使用pip安裝報錯:is not a supported wheel on this platform的解決方法。分享給大家供大家參考,具體如下:
可能的原因1:安裝的不是對應python版本的庫,下載的庫名中cp27代表python2.7,其它同理。
可能的原因2:這個是我遇到的情況(下載的是對應版本的庫,然后仍然提示不支持當前平臺)
在https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy中,我下載到的numpy庫文件名:
numpy-1.10.4+mkl-cp27-cp27m-win32.whl
使用pip安裝(在命令行中):
pip install numpy-1.10.4+mkl-cp27-cp27m-win32.whl
報錯:*** is not a supported wheel on this platform,通過在stackoverflow上的一個帖子成功解決問題。
方法:在shell中輸入
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-1.10.4+mkl-cp27-none-win32.whl即可成功安裝。
其它的庫也同理可以成功安裝,不過也請注意庫的依賴。
(參考帖子網址:http://stackoverflow.com/questions/28107123/cannot-install-numpy-from-wheel-format?rq=1)
補充:skimage庫安裝報錯的情況
同上述安裝報錯一樣,筆者在本機win7+Python2.7.9環境下安裝skimage庫:scikit_image‑0.13.1‑cp27‑cp27m‑win32.whl
報錯如下圖:

使用import pip; print(pip.pep425tags.get_supported())命令,結果如下:

此時將scikit_image‑0.13.1‑cp27‑cp27m‑win32.whl改為scikit_image-0.13.1-cp27-none-win32.whl
再使用
pip install scikit_image-0.13.1-cp27-none-win32.whl
安裝即可。
更多關于Python相關內容感興趣的讀者可查看本站專題:《Python進程與線程操作技巧總結》、《Python數據結構與算法教程》、《Python函數使用技巧總結》、《Python字符串操作技巧匯總》、《Python入門與進階經典教程》及《Python文件與目錄操作技巧匯總》
希望本文所述對大家Python程序設計有所幫助。
新聞熱點
疑難解答