xgboost 在 windows 上的安装

来源:互联网 发布:淘宝买家拆分订单发货 编辑:程序博客网 时间:2024/06/06 18:15

本文环境
anoconda3 + python3.6.1 + win10

一、 window上已经安装好anaconda3 ,git
二、 mingw-w64的安装(编译工具)
下载地址:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.3.0/threads-win32/seh/
点击下载x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z,适用64位操作系统。
另外,建议不要使用mingw-w64-install.exe(170.0 kB)在线下载,因为在选择安装版本后下载有些版本会崩掉(比如本版本)。
2、解压到某一目录下,我放到了C盘根目录。(目录最好不要有中文字符)
3、配置环境变量。将C:\mingw64\bin;粘贴到path环境变量下,用“;”隔开。
我的电脑图标->右键->属性->高级系统设置->选择“高级”选项->选择下面“环境变量”->用户变量或者系统变量均可,若无path则创建一个path变量。
4、进入目录C:\mingw64\bin,找到mingw32-make.exe 更名为make(为了使用方便)。成功后,在cmd下输入make会返回“make: * No targets specified and no makefile found. Stop.”。
三、安装xgboost
1、下载源码
git clone --recursivehttps://github.com/dmlc/xgboost
2、下载xgboost.dll(libxgboost.dll) 放到python-package/xgboost下 然后执行下面命令
cd xgboost
git submodule init
git submodule update
cp make/mingw64.mk config.mk
make -j4
cd python-package
python setup.py install

以上亲测,可用。
这里写图片描述
点击参考