mac下安裝xgboost報錯:clang: error: : errorunsupported option '-fopenmp'
阿新 • • 發佈:2019-02-16
在Mac os下安裝xgboost
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/minimum.mk ./config.mk; make -j4
這是不支援多執行緒版本的,如果想要支援多執行緒,那麼就要使用如下指令:
brew install gcc --without-multilib
brew相當於在Linux中的yum或者apt-get,可以到這裡 下載,也可以使用如下命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安裝brew命令
然後執行命令
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/config.mk ./config.mk; make -j4
有時候也會出現錯誤:
clang: error: : errorunsupported option '-fopenmp'
可以參考這裡 :
首先
ls /usr/local/bin/*
找到其中的gcc g++,然後
將./config.mk中的
$ export CC=/usr/local/bin/gcc-6 #自己的安裝路經
$ export CXX=/usr/local/bin/g++-6 #自己的安裝路徑
之後,重新 make -j4即可。
如果是利用python呼叫,那麼還需要
cd python-package; sudo python setup.py install
即可安裝完成。