您的位置:首页 > 其它

安装xgboost

2017-12-12 14:18 295 查看

官方教程:http://xgboost.readthedocs.io/en/latest/get_started/index.html

一、安装库:

1.Linux系统

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; make -j4

2.Windows 系统(官方方法)

 首先到github官网下载git bash

 然后下载库:

git clone --recursive https://github.com/dmlc/xgboost
git submodule init
git submodule update

XGBoost 编译支持  MSVC or MinGW.

git bash 使用MINGW64 在MinGW中 make命令使用mingw32-make,将如下命令添加到 

.bashrc文件中

alias make='mingw32-make'

编译

cp make/mingw64.mk config.mk; make -j4

如果使用MSVC编译,使用VS2013,MSVC 12 64 bit generator.

mkdir build
cd build
cmake .. -G"Visual Studio 12 2013 Win64"

将编译后的 libxgboost.dll 复制到 python-package\xgboost

 

问题:

1.make命令不存在

是因为mingw32-make  没有安装

https://sourceforge.net/projects/mingw-w64/?source=typ_redirect安装MinGW-w64我是64位机器,所以安装64bit

 

安装完成后将安装路径C:\Program Files\mingw-w64\x86_64-7.2.0-win32-seh-rt_v5-rev1\mingw64\bin添加到环境变量中

关闭 git bash然后再打开就可以看到mingw32-make安装成功

2.官方可能安装不成功

 使用如下编译过程:

cp make/mingw64.mk config.mk
cp make/mingw64.mk dmlc-core/config.mk

cd rabit
make lib/librabit_empty.a -j4

cd ../dmlc-core
make -j4

cd..
make -j4

安装:

cd python-package

python setup.py install import os os.environ['PATH'] = os.environ['PATH'] + ';C:\\Program Files\\mingw-w64\\x86_64-5.3.0-posix-seh-rt_v4-rev0\\mingw64\\bin'             Windows最简单更新方法:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#xgboost下载whl文件用pip 安装

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: