1. 程式人生 > >Failed building wheel for netifaces

Failed building wheel for netifaces

目錄

文章目錄

問題

安裝 OpenStackClient 的時候發現問題:

Failed building wheel for netifaces
Running setup.py clean for netifaces
Failed to build PyYAML netifaces
...

解決

需要找到和作業系統 PIP 環境相容的 netifaces 軟體包。
訪問 https://www.lfd.uci.edu/~gohlke/pythonlibs/#netifaces,搜尋 “netifaces” 找到版本列表。

Netifaces, portable network interface information.

netifaces‑0.10.7‑cp27‑cp27m‑win32.whl
netifaces‑0.10.7‑cp27‑cp27m‑win_amd64.whl
netifaces‑0.10.7‑cp34‑cp34m‑win32.whl
netifaces‑0.10.7‑cp34‑cp34m‑win_amd64.whl
netifaces‑0.10.7‑cp35‑cp35m‑win32.whl
netifaces‑0.10.7‑cp35‑cp35m‑win_amd64.whl
netifaces‑0.10.7‑cp36‑cp36m‑win32.whl
netifaces‑0.10.7‑cp36‑cp36m‑win_amd64.whl
netifaces‑0.10.7‑cp37‑cp37m‑win32.whl
netifaces‑0.10.7‑cp37‑cp37m‑win_amd64.whl

匹配作業系統的 PIP 環境:

Python 2.7.5 (default, Jul 13 2018, 13:06:57)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] 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')]
>>>

匹配元組(e.g. ('cp27', 'none', 'linux_x86_64'))和軟體清單發現沒有完全一致的軟體包。直接下載 netifaces‑0.10.7‑cp27‑cp27m‑win_amd64.whl,然後 rename。

mv netifaces-0.10.7-cp27-cp27m-win_amd64.whl netifaces-0.10.7-cp27-none-linux_x86_64.whl
pip install netifaces-0.10.7-cp27-none-linux_x86_64.whl

如果不 rename,則會觸發錯誤:

netifaces-0.10.7-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.

或者你只是缺少 python-dev

yum install python-devel