首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在Pip虚拟环境中Pip安装SHAP失败

在Pip虚拟环境中Pip安装SHAP失败
EN

Stack Overflow用户
提问于 2020-07-08 09:16:28
回答 1查看 3.2K关注 0票数 0

我在Linux服务器上使用Python 3.6.3上的pip虚拟环境。

我尝试过pip安装SHAP,但遇到以下错误:

代码语言:javascript
运行
复制
          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,但没有任何成功。

你能给我一些建议吗?提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2020-07-08 20:11:00

使您的安装崩溃的错误是:

代码语言:javascript
运行
复制
error trying to exec 'cc1plus': execvp: No such file or directory

可以通过安装g++来修复:

代码语言:javascript
运行
复制
sudo apt-get install g++

如果显示消息:找不到包,请尝试执行以下命令:

代码语言:javascript
运行
复制
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install g++
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62786126

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档