安装XGBoost库(macOS&window10)

xiaoxiao2021-02-28  124

前段时间装了windows10版,现在要回家呆一个月学车,故在mac上安装xgboost回家学习下。后面附windows版下载方法地址。

macOS安装:

1.安装 Homebrew 

2.安装最新版本的gcc (gcc-6)

brew install gcc --without-multilib

这步比较耗时,用了将近1小时。

3.从git上下载源码

cd进入你想要安装的目录,然后输入下面的代码。(我是直接在打开终端的目录)

git clone --recursive https://github.com/dmlc/xgboost  cd xgboost; cp make/config.mk ./config.mk; make -j4 出现了如下错误:

clang: error: unsupported option '-fopenmp'

错误原因:You installed gcc with Homebrew, yet the error is from clang. That should simply mean that your default compiler still points to clang instead of the newly installed gcc.

解决方案:

cd xgboost; cp make/minimum.mk ./config.mk; make -j4

替换

cd xgboost; cp make/config.mk ./config.mk; make -j4

最后在make -j4     即可。

如果是利用Python调用,那么还需要

cd python-package; sudo python setup.py install 1

即可安装完成。

Window10安装: 1.地址   http://www.lfd.uci.edu/~gohlke/pythonlibs/#xgboost 2.找到对应自己电脑版本以及python版本(只支持python3.5与3.6)的xgboost  3.用 cd 到xgboost下载好的路径,再用pip安装 pip3 install xgboost......(用tab补全你下载的xgboost的版本号) 1 参考资料:http://www.cnblogs.com/chenhuan001/p/5595380.html https://stackoverflow.com/questions/36211018/clang-error-errorunsupported-option-fopenmp-on-mac-osx-el-capitan-buildin http://blog.csdn.net/kamendula/article/details/53166247
转载请注明原文地址: https://www.6miu.com/read-23077.html

最新回复(0)