如何为Python安装SHAP(Shapley)

如何为Python安装SHAP(Shapley),python,installation,xgboost,Python,Installation,Xgboost,尝试使用安装Shapley软件包(在R中提供) 但有一个错误: Building wheels for collected packages: shap, iml Running setup.py bdist_wheel for shap ... error Complete output from command C:\Users\Toly_Novik\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C

尝试使用安装Shapley软件包(在R中提供)

但有一个错误:

Building wheels for collected packages: shap, iml
Running setup.py bdist_wheel for shap ... error
Complete output from command C:\Users\Toly_Novik\Anaconda3\python.exe -u -c     "import setuptools, tokenize;__file__='C:\\Users\\TOLY_N~1\\AppData\\Local\\Temp  \\pip-install-o0p96nl3\\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 C:\Users\TOLY_N~1\AppData\Local\Temp\pip-wheel-538qnmm2 --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\shap
copying shap\datasets.py -> build\lib.win-amd64-3.6\shap
copying shap\plots.py -> build\lib.win-amd64-3.6\shap
copying shap\__init__.py -> build\lib.win-amd64-3.6\shap
creating build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\ime.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\kernel.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\mimic.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\pytree.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\tree.py -> build\lib.win-amd64-3.6\shap\explainers
copying shap\explainers\__init__.py -> build\lib.win-amd64-3.6 \shap\explainers
running build_ext
numpy.get_include() C:\Users\Toly_Novik\Anaconda3\lib\site-packages\numpy\core\include
building 'shap._cext' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual  C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
同样的故事
安装xgboost

您是否打算安装shapely()? 在python中,您可以通过执行
pip install shapely

对于windows shapley,可以通过从和下载.whl来安装

pip安装

或者,如果你使用的是巨蟒,你可以使用conda forge来塑造你的身材

conda config——添加conda forge频道
康达完美安装


要安装xgboost,请参阅 为此,您可能需要gcc(c/c++编译器)或同等的Microsoft替代方案


对于带有conda的xgboost,您可以看到这个stackoverflow.com/questions/35139108/…或者只需执行
conda安装py xgboost

您打算安装shapely()? 在python中,您可以通过执行
pip install shapely

对于windows shapley,可以通过从和下载.whl来安装

pip安装

或者,如果你使用的是巨蟒,你可以使用conda forge来塑造你的身材

conda config——添加conda forge频道
康达完美安装


要安装xgboost,请参阅 为此,您可能需要gcc(c/c++编译器)或同等的Microsoft替代方案


对于使用conda的xgboost,您可以看到这个stackoverflow.com/questions/35139108/…或者只需执行
conda安装py xgboost

您是否正在尝试安装shap-一个用于解释机器学习模型的库?如果是,请使用

pip install shap

有关更多信息,请参阅shap文档:

您是否正在尝试安装shap-一个用于解释机器学习模型的库?如果是,请使用

pip install shap

有关更多信息,请参阅shap文档:

在lgeos=CDLL(“geos_C.dll”)文件“C:\Users\TOLY_Novik\Anaconda3\lib\ctypes_init_.py”第348行的初始self中,在lgeos=CDLL(“geos_C.dll”)文件“C:\Users\TOLY_Novik\Anaconda3\lib\ctypes_init_.py”中,第200行。错误:[WinError 126]找不到指定的模块。我猜您正在使用windows。请参阅windows的说明
安装Shapely 1.6 windows用户有两个很好的安装选项:位于http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely和巨蟒平台的[conda forge](https://conda-forge.github.io/)频道。
您可以从下载.whl文件并进行
pip安装
好的,对不起,我从您的错误消息中看到您正在使用anaconda。因此,您也可以进行
conda配置--为xgboost添加频道conda forge
conda shapely安装
,使用conda您可以看到这一点,或者只需执行
conda安装xgboost即可;)在lgeos=CDLL(“geos_C.dll”)文件“C:\Users\TOLY_Novik\Anaconda3\lib\ctypes_init_.py”第348行的初始self中,获取了错误文件“C:\Users\TOLY_N~1\AppData\Local\Temp\pip-install-qm2ts1b\shapely\shapely_buildcfg.py”,第200行找不到指定的模块我猜您正在使用windows。请参阅windows的说明
安装Shapely 1.6 windows用户有两个很好的安装选项:位于http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely和巨蟒平台的[conda forge](https://conda-forge.github.io/)频道。
您可以从下载.whl文件并进行
pip安装
好的,对不起,我从您的错误消息中看到您正在使用anaconda。因此,您也可以进行
conda配置--为xgboost添加频道conda forge
conda shapely安装
,使用conda您可以看到这一点,或者只需执行
conda安装xgboost即可;)正确答案,shapely是一些geo软件包,shap用于机器学习。我使用conda在windows上安装了它。正确答案,shapely是一些geo软件包,shap用于机器学习。我使用conda在windows上安装了它。