Windows xgboost 错误

Windows xgboost error

安装 xgboost 库很痛苦,但现在在 Windows 8.1 64 位

上发生了其他错误
import xgboost as xgb

Traceback (most recent call last):
  File "C:/Users/Пашка/PycharmProjects/kaggler bank santander/1.py", line 12, in <module>
    import xgboost as xgb
  File "C:\Python34\lib\site-packages\xgboost-0.4-py3.4.egg\xgboost\__init__.py", line 11, in <module>
    from .core import DMatrix, Booster
  File "C:\Python34\lib\site-packages\xgboost-0.4-py3.4.egg\xgboost\core.py", line 83, in <module>
    _LIB = _load_lib()
  File "C:\Python34\lib\site-packages\xgboost-0.4-py3.4.egg\xgboost\core.py", line 77, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "C:\Python34\lib\ctypes\__init__.py", line 429, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

可以做什么?我认为这是因为 .py 文件在 Windows 中的关联方式,我猜

我认为安装 xgboost 的最简单(最轻松)的方法可以在这里找到:

https://dnc1994.com/2016/03/installing-xgboost-on-windows/(非常感谢作者!)

我按照作者的说明下载了 TDM-GCC,然后按照他们的说明进行操作。

此外,我在 32 位 Python 上安装 xgboost 时遇到了类似的问题,但在使用 64 位 Python 时没有遇到任何问题。

注意:我 运行 Python 2.7 Windows 7.

在 Windows 上构建最近变得更加简单:

安装CMake

CMake 可以从这里下载:https://cmake.org/download/

我下载了 64 位 zip 文件:https://cmake.org/files/v3.6/cmake-3.6.2-win64-x64.zip 并将其解压到 c:\dev\cmake-3.6.2-win64-x64.

构建 XGBoost

要构建 XGBoost,请按照以下步骤操作:

  • git 克隆 https://github.com/dmlc/xgboost.git
  • cd xgboost
  • git 子模块初始化
  • git 子模块更新
  • mkdir 构建
  • 光盘构建
  • C:\dev\cmake-3.6.2-win64-x64\bin\cmake.exe .. -G”Visual Studio 14 2015 * Win64″
  • C:\Program Files (x86)\MSBuild.0\Bin\msbuild.exe /t:Clean,Rebuild /p:Configuration=Release xgboost.sln

或者只下载二进制文件 (x64)

非官方(我的)夜间构建 here