標籤:xgboost python win7
主要分為四個步驟:
1.首先下載安裝mingw64
2.安裝Anaconda及git
3.下載xgboost,我參考的是 52300869
4.安裝xgboost
具體如下:
(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,如果輸出如下,說明成功了
強烈推薦Anaconda,https://www.anaconda.com/
你百度一下就知道它的好了
git的安裝:在Anaconda Prompt中輸入
conda install git
在開始菜單裡開啟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
(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如果沒有提示錯誤,恭喜啦
WIN7-64 python xgboost 安裝