项目场景:
使用pip安装neutron-lib,Build netifaces、Yappi 报错处理
问题描述:
使用pip安装neutron-lib,提示Build netifaces、Yappi 报错
ERROR: Failed building wheel for netifaces
Running setup.py clean for netifaces
Building wheel for Yappi (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'e:\myproject\venv\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\my\\AppData\\Local\\Temp\\pip-install-ldxeke3b\\yappi_11c85cddc3104269a9aad04b53cf39dd\\setup.py'"'
"'; __file__='"'"'C:\\Users\\my\\AppData\\Local\\Temp\\pip-install-ldxeke3b\\yappi_11c85cddc3104269a9aad04b53cf39dd\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO
('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\my\AppData\Local\Temp\pip-wheel-av4v53yb'
cwd: C:\Users\my\AppData\Local\Temp\pip-install-ldxeke3b\yappi_11c85cddc3104269a9aad04b53cf39dd\
Complete output (9 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
copying yappi\yappi.py -> build\lib.win-amd64-3.10
running build_ext
building '_yappi' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for Yappi
Running setup.py clean for Yappi
Failed to build setproctitle netifaces Yappi
ERROR: Could not build wheels for setproctitle, which is required to install pyproject.toml-based projects
原因分析及解决办法:
发现报错是build netifaces、Yappi包的时候报错,访问网站:https://www.lfd.uci.edu/~gohlke/pythonlibs/,在界面 Ctrl+F 查找netifaces、Yappi,因为我装的是python3.9,系统是64位的,所以我选择下载如下图所示的whl文件
下载完以后找到对应的.whl文件,使用pip安装,安装命令如下所示:
pip install E:\Programs\netifaces-0.11.0-cp39-cp39-win_amd64.whl
pip install E:\Programs\yappi-1.3.3-cp39-cp39-win_amd64.whl
安装完以后,继续使用pip安装neutron-lib,成功安装(如果还是报错bulid xxx失败,就继续去网站https://www.lfd.uci.edu/~gohlke/pythonlibs/上搜相应的.whl文件,下载下来用pip安装,直到pip安装neutron-lib成功)