1.安装Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.安装最新版本gcc
brew install gcc --without-multilib
安装最新版的gcc,安装好以后确认是gcc7,g++7
git clone --recursive https://github.com/dmlc/xgboost
-
编译xgboost
cd xgboost; cp make/config.mk ./config.mk; make -j4
这时候会报错clang: error: : errorunsupported option '-fopenmp'
修改config.md
export CC = /usr/local/bin/gcc-7
export CXX = /usr/local/bin/g++-7
重新编译成功了。
4.在python中调用
cd python-package; sudo python setup.py install
终于安装好了。
网友评论