windows下安装xgboost教程

问题:直接用pip install xgboost时,存在下图的问题,

windows下安装xgboost教程

解决方案:

1.安装mingw-w64

(安装时,Architecture选择x86_64,其他不变

(安装后,配置环境变量:在Path中添加H:\adasoftware\mingw64\mingw64\bin)

(然后,在mingw64目录下找到mingw32-make.exe 并将更名为make.exe【不然后面使用make -j4时会出现:make:command not find】,这是为了方便后面使用make -j4

(最后,在cmd下输入make会返回“make: *** No targets specified and no makefile found. Stop.”

windows下安装xgboost教程

2.安装git(下载老是出错,可以放上*)(默认安装即可)(配置git环境变量:在path中添加H:\adasoftware\Git\bin)

windows下安装xgboost教程

4.添加anaconda的3个环境变量(在path中添加:H:\adasoftware\anacon\Library\bin,H:\adasoftware\anacon\Scripts,H:\adasoftware\anacon)(这里anaconda的路径其实就是python的路径

windows下安装xgboost教程

3.安装pip

4.安装numpy和scipy

5.安装xgboost

  • 点击桌面git bash图标,打开git-bash,使用:git clone --recursive https://github.com/dmlc/xgboost

windows下安装xgboost教程

  • 然后,依次使用下列7个命令:
   cd xgboost    

git submodule init

git submodule update

cp make/mingw64.mk config.mk

make -j4

cd python-package

python setup.py install

  • 安装完毕,重启 jupyter notebook即可。

相关软件下载链接(文字可点击):

1.MinGW-w64 - for 32 and 64 bit Windows

2.git