本文講述了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
報錯如下圖:
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiYWan5iYyQzN0IWZycTY0QjY0kTOyIGN2QGNxEzNmBTNjFzN28CX0JXZ252bj91Ztl2Lc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.gif)
使用import pip; print(pip.pep425tags.get_supported())指令,結果如下:
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiYWan5iYyQzN0IWZycTY0QjY0kTOyIGN2QGNxEzNmBTNjFzN28CX0JXZ252bj91Ztl2Lc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.gif)
此時将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程式設計有所幫助。