1.环境:
python 3.7版本 64位的,原来 python3.8版本的安装不了,平台不支持
2.直接pip3 install xgboost
3.然后有出错提示xgboost.core.XGBoostError: XGBoost Library (xgboost.dll) could not be loaded.
4.找到python 安装目录
C:\Users\pc\AppData\Local\Programs\Python\Python37
在目录下有个xgboost目录下有两个文件 vcomp140.dll 和 xgboost.dell
然后把xgboost安装目录下的 vcomp140.dll 和 xgboost.dll copy 到C:/WINDOWS/System32 目录下
5.打开jupyter ,运行:
import ctypes
ctypes.cdll.LoadLibrary('C:/WINDOWS/System32/vcomp140.dll')
ctypes.cdll.LoadLibrary('C:/WINDOWS/System32/xgboost.dll')
6.测试:
import xgboost as xgb
成功