如何在python(windows平台)中安装xgboost包? [英] How to install xgboost package in python (windows platform)?

查看:45
本文介绍了如何在python(windows平台)中安装xgboost包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://xgboost.readthedocs.org/en/latest/python/python_intro.html

在 xgboost 的主页上(上面的链接),它说:要安装 XGBoost,请执行以下步骤:

On the homepage of xgboost(above link), it says: To install XGBoost, do the following steps:

  1. 需要在项目根目录下运行make

在python-package目录下运行

In the python-package directory run

python setup.py install

python setup.py install

但是,当我这样做时,对于第 1 步,出现以下错误:make :术语make"不被识别为 cmdlet、函数、脚本文件或可运行程序的名称.检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试.

However, when I did it, for step 1 the following error appear: make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

然后我跳过step1直接做了step 2,又出现一个错误:

then I skip step1 and did step 2 directly, another error appear:

Traceback (most recent call last):
  File "setup.py", line 19, in <module>
    LIB_PATH = libpath['find_lib_path']()
  File "xgboost/libpath.py", line 44, in find_lib_path
    'List of candidates:
' + ('
'.join(dll_path)))
__builtin__.XGBoostLibraryNotFound: Cannot find XGBoost Libarary in the candicate path, did you install compilers and run build.sh in root path?

有谁知道如何在Windows10平台上安装xgboost for python?感谢您的帮助!

Does anyone know how to install xgboost for python on Windows10 platform? Thanks for your help!

推荐答案

我在 Windows 8 64bit、Python 2.7 和 Visual Studio 2013 中成功安装了 XGBoost(不需要 mingw64)

I installed XGBoost successfully in Windows 8 64bit, Python 2.7 with Visual Studio 2013 (don't need mingw64)

2017 年 2 月 15 日更新

使用较新版本的 XGBoost,这是我的步骤

With newer version of XGBoost, here are my steps

步骤 1. 安装 cmake https://cmake.org/download/

验证cmake是否安装成功

$ cmake
Usage

cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
...

步骤 2. 克隆 xgboost 源

Step 2. Clone xgboost source

$ git clone https://github.com/dmlc/xgboost xgboost_dir

第 3 步.创建 Visual Studio 项目

Step 3. Create Visual Studio Project

$ cd xgboost_dir
$ mkdir build
$ cd build
$ cmake .. -G"Visual Studio 12 2013 Win64"

步骤 4. 构建 Visual Studio 2013 项目

Step 4. Build Visual Studio 2013 project

  • 使用 Visual Studio 2013 打开文件 xgboost_dir/build/ALL_BUILD.vcxproj
  • 在 Visual Studio 2013 中,打开 BUILD >配置管理器...
    • 在活动解决方案配置中选择发布
    • 在 Active 解决方案平台中选择 x64

    构建解决方案后,在xgboost_dir/lib

    步骤 5. 构建 python 包

    Step 5. Build python package

    • 将文件libxgboost.dll复制到xgboost_dir/python-package
    • 将目录切换到xgboost_dir/python-package文件夹
    • 运行命令python setup.py install
    • Copy file libxgboost.dll to xgboost_dir/python-package
    • Change directory to xgboost_dir/python-package folder
    • Run command python setup.py install

    验证xgboost是否安装成功

    Verify xgboost have been installed successfully

    $ python -c "import xgboost"
    

    旧答案

    这是我的步骤:

    1. git 克隆 https://github.com/dmlc/xgboost
    2. git 结帐 9bc3d16
    3. 使用 Visual Studio 2013 在 xgboost/windows 中打开项目
    4. 在 Visual Studio 2013 中,打开 BUILD >配置管理器...,
      • Active solution configuration
      • 中选择Release
      • Active solution platform
      • 中选择x64

    这篇关于如何在python(windows平台)中安装xgboost包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆