czhtr 发表于 2018-8-7 12:06:59

WIN7-64 python xgboost 安装

  
  主要分为四个步骤:
  1.首先下载安装mingw64
  2.安装Anaconda及git
  3.下载xgboost,我参考的是 https://blog.csdn.net/leo_xu06/article/details/52300869
  4.安装xgboost
  具体如下:

[*]  1.首先下载安装mingw64
  (1)下载地址为http://mingw-w64.org/doku.php/download

  往下拉看到:

  点击进去,进入页面如下:https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/

  点击最上面的绿色下载,https://sourceforge.net/projects/mingw-w64/files/latest/download?source=files

  开始安装

  注意蓝色标记部分

  恭喜安装成功!

  (2)将mingw32-make.exe的路径加到 用户path:C:\Program Files\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin
  像我这种小白,不熟悉的安装都会默认C盘,哈哈
  不会加路径变量?我要嘲笑你啦!

  (3)然后,打开cmd,输入mingw32-make,如果输出如下,说明成功了


[*]  2.安装python ,git
  强烈推荐Anaconda,https://www.anaconda.com/
  你百度一下就知道它的好了
  git的安装:在Anaconda Prompt中输入
  conda install git

[*]  3.下载xgboost
  在开始菜单里打开Git Bash,首先在c/Users新建一个文件夹xgboostCode用于存放代码和下载文件,然后在刚刚打开的Bash终端中输入下面命令,定位目录
  $ cd /c/Users/xgboostCode/
  然后用下面的命令从GitHub下载XGBoost。(我自己单独下载过,但是不知道怎么安装,捂脸~)
  $ git clone --recursive https://github.com/dmlc/xgboost
  $ cd xgboost
  $ git submodule init
  $ git submodule update


[*]  64位的编译器MinGW-W64来编译下载的代码,上面已经提供下载地址


[*]  4.安装xgboost
  (1)利用windows的程序搜索打开“git bash”,长得和cmd差不多,但是要用到一个cmd中不支持的命令。打开之后输入:


[*]  $ cd /c/Users/xgboostCode/xgboost #定位到文件夹
[*]  $ cd dmlc-core
[*]  $ make -j4
[*]  $ cd ../rabit
[*]  $ make lib/librabit_empty.a -j4
[*]  $ cd ..
[*]  $ cp make/mingw64.mk config.mk
[*]  $ make -j4

  #编译完成
  (2)执行完成之后就可以在Anaconda中安装XGBoost的python模块了。在电脑的开始菜单中打开Anaconda Prompt,输入下面命令:
  cd xgboostCode\xgboost\python-package
  (3)然后输入安装命令:
  python setup.py install
  在python中输入import xgboost如果没有提示错误,恭喜啦
页: [1]
查看完整版本: WIN7-64 python xgboost 安装