代码改变世界

Failed building wheel for netifaces

2018-10-31 11:30  云物互联  阅读(966)  评论(0编辑  收藏  举报

目录

文章目录

问题

安装 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