简体   繁体   English

如何在Windows上轻松安装xgboost

[英]how to install xgboost easily on windows

i have been struggling with xgboost installation , i did many things but i can see this might work . 我一直在努力安装x​​gboost,我做了很多事情,但我可以看到可能有效。 I downloaded the file xgboost.rar and then extracted it into Lib/Site packages 我下载了文件xgboost.rar ,然后将其压缩到Lib / Site包中

now when i opening my site packages it is showing xgboost but when i import xgboost it says no module named xgboost . 现在,当我打开网站包时,它显示xgboost,但是当我import xgboost它说no module named xgboost

please please help 请帮忙

from the documentation : 文档中

import os
os.environ['PATH'] = os.environ['PATH'] + ';C:\\Program Files\\mingw-w64\\x86_64-5.3.0-posix-seh-rt_v4-rev0\\mingw64\\bin'

You can pip install catboost. 您可以点安装catboost。 It is a recently open-sourced gradient boosting library, which has similar interfaces, is in most cases more accurate and faster than XGBoost, and it has categorical features support. 它是最近开放源代码的梯度增强库,具有相似的接口,在大多数情况下比XGBoost更为准确和快速,并且支持分类功能。 Here is the site of the library: https://catboost.yandex 这是该库的站点: https : //catboost.yandex

You first need to build the library through "make", then you can install using anaconda prompt (if you want it on anaconda) or git bash (if you use it in Python only). 您首先需要通过“ make”构建库,然后可以使用anaconda提示符(如果要在anaconda上安装)或git bash(如果仅在Python中使用)进行安装。

First follow the official guide with the following procedure (in Git Bash on Windows): 首先,按照以下步骤(在Windows上的Git Bash中)遵循官方指南:

git clone --recursive https://github.com/dmlc/xgboost
git submodule init
git submodule update

then install TDM-GCC here and do the following in Git Bash: 然后在此处安装TDM-GCC并在Git Bash中执行以下操作:

alias make='mingw32-make' cp make/mingw64.mk config.mk; 别名make ='mingw32-make'cp make / mingw64.mk config.mk; make -j4 使-j4

Last, do the following using anaconda prompt or Git Bash: 最后,使用anaconda提示符或Git Bash执行以下操作:

cd xgboost\\python-package cd xgboost \\ python-package
python setup.py install python setup.py安装

Also refer to these great resources: 另请参阅以下重要资源:

Official Guide 官方指南

Installing Xgboost on Windows 在Windows上安装Xgboost

Installing XGBoost For Anaconda on Windows 在Windows上为Anaconda安装XGBoost

Alternatively what you can do is from this link you can download the C pre-compiled library and install it using the pip install < FILE-NAME.whl> command. 或者,您可以从该链接执行操作,您可以下载C预编译的库并使用pip install <FILE-NAME.whl>命令进行安装。 Ensure you have downloaded the library which is compatible with your python version. 确保您已下载与python版本兼容的库。

I experienced this problem while I was using the same in Anaconda(Spyder). 我在Anaconda(Spyder)中使用相同的打印机时遇到了这个问题。 Then just restart the kernel and your error will go away. 然后只需重新启动内核,您的错误就会消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM