MacOS下安装xgboost和lightGBM报错,之前安装成功,换了python环境后安装失败
信息如下:
ERROR: Command errored out with exit status 1:
command: /Users/shuzip/opt/anaconda3/bin/python -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/private/tmp/pip-install-iebpqutp/xgboost/setup.py’"’"’; file=’"’"’/private/tmp/pip-install-iebpqutp/xgboost/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ egg_info --egg-base pip-egg-info
cwd: /private/tmp/pip-install-iebpqutp/xgboost/
Complete output (27 lines):
++ pwd
+ oldpath=/private/tmp/pip-install-iebpqutp/xgboost
+ cd ./xgboost/
+ mkdir -p build
+ cd build
+ cmake …
./xgboost/build-python.sh: line 21: cmake: command not found
+ echo -----------------------------
-----------------------------
+ echo ‘Building multi-thread xgboost failed’
Building multi-thread xgboost failed
+ echo ‘Start to build single-thread xgboost’
Start to build single-thread xgboost
+ cmake … -DUSE_OPENMP=0
./xgboost/build-python.sh: line 27: cmake: command not found
Traceback (most recent call last):
File “”, line 1, in
File “/private/tmp/pip-install-iebpqutp/xgboost/setup.py”, line 42, in
LIB_PATH = libpath’find_lib_path’
File “/private/tmp/pip-install-iebpqutp/xgboost/xgboost/libpath.py”, line 50, in find_lib_path
‘List of candidates:\n’ + (’\n’.join(dll_path)))
XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
/private/tmp/pip-install-iebpqutp/xgboost/xgboost/libxgboost.dylib
/private/tmp/pip-install-iebpqutp/xgboost/xgboost/…/…/lib/libxgboost.dylib
/private/tmp/pip-install-iebpqutp/xgboost/xgboost/./lib/libxgboost.dylib
/Users/shuzip/opt/anaconda3/xgboost/libxgboost.dylib
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
原因CMAKE掉了…
解决方案,重装CMAKE
建议安装方法:
brew install cmake
之后再执行pip install xgboost
pip install xgboost
解决。