windows10之上python安装xgboost采用如下步骤(https://stackoverflow.com/questions/33749735/how-to-install-xgboost-package-in-python-windows-platform):
- download xgboost whl file from here (make sure to match your python version and system architecture, e.g. "xgboost-0.6-cp35-cp35m-win_amd64.whl" for python 3.5 on 64-bit machine)
- open command prompt
-
cd
to your Downloads folder (or wherever you saved the whl file) -
pip install xgboost-0.6-cp35-cp35m-win_amd64.whl
(or whatever your whl file is named)
import xgboost as xgb
Traceback (most recent call last):File "<stdin>", line 1, in <module>
File "xgboost\__init__.py", line 11, in <module>
from .core import DMatrix, Booster
File "xgboost\core.py", line 115, in <module>
_LIB = _load_lib()
File "xgboost\core.py", line 109, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "C:\Python27\lib\ctypes\__init__.py", line 444, in LoadLibrary
return self._dlltype(name)
File "C:\Python27\lib\ctypes\__init__.py", line 366, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126]
造成该问题的原因为:电脑缺少VC++相关运行库。
解决方法:下载VC++运行库,64位版本下载地址为 https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=48145