我想在我的筆記本電腦上安裝xgboost以便在anaconda中使用。在遵循這個鏈接https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en後,以及(我認爲)每一步都被正確實現了,當我嘗試在anaconda中導入xgboost時,我得到:[WinError 127]無法找到指定的過程。我搜索了很多,但仍然沒有設法找到解決方案,所以我希望有人有光。由於xgboost WinError127,Windows 10,anaconda
編輯: 所使用的代碼就像在鏈接
import os
mingw_path = 'C:\\Program Files\\mingw-w64\\x86_64-5.3.0-posix-seh-rt_v4-rev0\\mingw64\\bin'
os.environ['PATH'] = mingw_path + ';' + os.environ['PATH']
import xgboost as xgb
import numpy as np
data = np.random.rand(5,10) # 5 entities, each contains 10 features
label = np.random.randint(2, size=5) # binary target
dtrain = xgb.DMatrix(data, label=label)
dtest = dtrain
param = {'bst:max_depth':2, 'bst:eta':1, 'silent':1, 'objective':'binary:logistic' }
param['nthread'] = 4
param['eval_metric'] = 'auc'
evallist = [(dtest,'eval'), (dtrain,'train')]
num_round = 10
bst = xgb.train(param, dtrain, num_round, evallist)
bst.dump_model('dump.raw.txt')
錯誤:
Traceback (most recent call last):
File "<ipython-input-2-162883d28707>", line 7, in <module>
import xgboost as xgb
File "C:\Anaconda\lib\site-packages\xgboost-0.6-py3.6.egg\xgboost\__init__.py", line 11, in <module>
from .core import DMatrix, Booster
File "C:\Anaconda\lib\site-packages\xgboost-0.6-py3.6.egg\xgboost\core.py", line 115, in <module>
_LIB = _load_lib()
File "C:\Anaconda\lib\site-packages\xgboost-0.6-py3.6.egg\xgboost\core.py", line 109, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "C:\Anaconda\lib\ctypes\__init__.py", line 426, in LoadLibrary
return self._dlltype(name)
File "C:\Anaconda\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 127] Impossível localizar o procedimento especificado
請發送完整回溯 – roganjosh
對不起,您的意思是整個錯誤代碼? – stasisOo
不只是錯誤,而是錯誤附帶的所有文本。這顯示了這個錯誤的起源。 – roganjosh