我在 Linux 服务器上的 Python 3.6.3 上使用 pip 虚拟环境。
我尝试 pip 安装 SHAP 但遇到以下错误:
Building wheel for shap (setup.py) ... error
ERROR: Complete output from command XXXX/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-aq97v0m2/shap/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-v9vyt50m --python-tag cp36:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/shap
copying shap/common.py -> build/lib.linux-x86_64-3.6/shap
copying shap/__init__.py -> build/lib.linux-x86_64-3.6/shap
copying shap/datasets.py -> build/lib.linux-x86_64-3.6/shap
creating build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/pytree.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/deep.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/sampling.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/mimic.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/__init__.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/linear.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/gradient.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/explainer.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/kernel.py -> build/lib.linux-x86_64-3.6/shap/explainers
copying shap/explainers/tree.py -> build/lib.linux-x86_64-3.6/shap/explainers
creating build/lib.linux-x86_64-3.6/shap/explainers/other
copying shap/explainers/other/random.py -> build/lib.linux-x86_64-3.6/shap/explainers/other
copying shap/explainers/other/__init__.py -> build/lib.linux-x86_64-3.6/shap/explainers/other
copying shap/explainers/other/coefficent.py -> build/lib.linux-x86_64-3.6/shap/explainers/other
creating build/lib.linux-x86_64-3.6/shap/plots
copying shap/plots/colors.py -> build/lib.linux-x86_64-3.6/shap/plots
copying shap/plots/image.py -> build/lib.linux-x86_64-3.6/shap/plots
copying shap/plots/dependence.py -> build/lib.linux-x86_64-3.6/shap/plots
copying shap/plots/summary.py -> build/lib.linux-x86_64-3.6/shap/plots
copying shap/plots/__init__.py -> build/lib.linux-x86_64-3.6/shap/plots
copying shap/plots/force.py -> build/lib.linux-x86_64-3.6/shap/plots
creating build/lib.linux-x86_64-3.6/shap/benchmark
copying shap/benchmark/plots.py -> build/lib.linux-x86_64-3.6/shap/benchmark
copying shap/benchmark/__init__.py -> build/lib.linux-x86_64-3.6/shap/benchmark
copying shap/benchmark/methods.py -> build/lib.linux-x86_64-3.6/shap/benchmark
copying shap/benchmark/scorers.py -> build/lib.linux-x86_64-3.6/shap/benchmark
copying shap/benchmark/metrics.py -> build/lib.linux-x86_64-3.6/shap/benchmark
creating build/lib.linux-x86_64-3.6/shap/plots/resources
copying shap/plots/resources/logoSmallGray.png -> build/lib.linux-x86_64-3.6/shap/plots/resources
copying shap/plots/resources/bundle.js -> build/lib.linux-x86_64-3.6/shap/plots/resources
running build_ext
numpy.get_include() /usr/local/share/anaconda/anaconda3-5.0.1/lib/python3.6/site-packages/numpy/core/include
building 'shap._cext' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/shap
gcc -pthread -B /usr/local/share/anaconda/anaconda3-5.0.1/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/XXX/include -I/usr/local/share/anaconda/anaconda3-5.0.1/include/python3.6m -I/usr/local/share/anaconda/anaconda3-5.0.1/lib/python3.6/site-packages/numpy/core/include -c shap/_cext.cc -o build/temp.linux-x86_64-3.6/shap/_cext.o
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for shap
Running setup.py clean for shap
Failed to build shap
Installing collected packages: shap
Running setup.py install for shap ... error
我浏览了一些类似的问题并尝试通过指定包版本来安装 SHAP,但没有任何成功。
你能请教吗?提前致谢!