安装xgboost

官方教程: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-packagexgboost

问题:

1.make命令不存在

是因为mingw32-make  没有安装

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

安装完成后将安装路径C:Program Filesmingw-w64x86_64-7.2.0-win32-seh-rt_v5-rev1mingw64in添加到环境变量中

关闭 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.cnblogs.com/dj0325/p/8027556.html