本人64位windows下安装最新版XGBoost,附操作步骤图

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Ai_Smith/article/details/53437124

    最新更新的XGBoost与老版安装方式不再一样,具体安装步骤如下:

1、 材料

系统:win7 64位 sp5 (win7、win10亲测都可以)

下载安装cmake:

https://cmake.org/files/v3.7/cmake-3.7.1-win64-x64.msi

下载安装VS2013 sp5

安装git,安装Anaconda,百度就有


2、安装步骤

打开Git Bash,输入指令:

$cd c: 

$git clone–recursive  https://github.com/dmlc/xgboost 

$cd xgboost 

$git submodule init 

$git submodule update 

$mkdir build

$cd build

$cmake ..-G"Visual Studio 12 2013 Win64"

编译完成后,看到如下图显示:


说明:注意指定为自己的VS编译器型号,我的是vs2013 win64版本,根据自己的版本选择,包括15 2017,14 2015,12 2013,11 2012,10 2010,9 2008,8 2005。

使用VS打开build目录下的xgboost.sln

按下图编译:



编译结果如下图:


lib目录下多出了libxgboost.dll文件


将libxgboost.dll 拷贝到python-package\xgboost。

检查distutils模块是否安装,进入python后import一下就知道,没装的自己安装,通常都会有的,安装好后进入bash终端:

$cd python-package 

$python setup.py install

完成安装,结果如下图:


此时,在Anaconda的site-packages中出现了xgboost-0.6-py2.7.egg文件夹,如下图:



3、 测试导入

进入终端:

>python

>>>import xgboost 

并未出现:ImportError: Nomodule named xgboost,说明安装成功了。

启动Pycharm也可以同样导入XGBoost。






猜你喜欢

转载自blog.csdn.net/Ai_Smith/article/details/53437124