Windows 7,R 工作正常
蟒蛇2.7.10 | EPD 7.5-3(64 位)、numpy、scipy、theano 等工作正常
脚步:
python setup.py install
,再次没有可见错误>>>import xgboost
File "<stdin>", line 1, in <module>
File "xgboost\__init__.py", line 11, in <module>
from .core import DMatrix, Booster
File "xgboost\core.py", line 83, in <module>
_LIB = _load_lib()
File "xgboost\core.py", line 77, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "P:\Python\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "P:\Python\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 127] The specified procedure could not be found
我破解了 core.py 以检查它实际尝试加载的库:)
它实际上在寻找正确的 dll
/Sources/xgb/python-package/xgboost/../../lib/libxgboost.dll
这正是它所在的位置,几分钟前刚建成的
你如何构建 xgboost?
你应该遵循这个:
http://xgboost.readthedocs.io/en/latest/build.html#building -on-windows
我和你有完全相同的错误。
尝试在您的机器上卸载其他版本的 Python 并重新启动。 我知道这不是一个好的解决方案,但它对我有用。
我有同样的错误,但修复留下了许多未解决的问题。 我最初使用 minGW 编译时使用了一些更清晰的说明。
事实证明,无论出于何种原因,将 mingw 路径放在系统路径的_beginning_ (而不是对我来说结束)解决了该编译的问题。
>>> dir = r'C:\Program Files\mingw-w64\x86_64-6.2.0-posix-seh-rt_v5-rev1\mingw64\bin'
>>> import os
>>> os.environ['PATH'].count(dir) # Here I show its already in the path at least once
1
>>> os.environ['PATH'].find(dir) # We see its at the end of my path
1491
>>> os.environ['PATH'] = dir + ';' + os.environ['PATH'] # I put it on the beginning of the path, NOT THE END.
>>> import xgboost # I modified core.py to print the directory of the requested dll. It imports successfully.
C:\Users\Joey\Anaconda2\lib\site-packages\xgboost-0.6-py2.7.egg\xgboost\libxgboost.dll
这是它起作用的唯一方法
请注意,请求的dll的目录在失败和成功的情况下都是一样的,所以不是这样。 唯一改变的是将 mingw/bin 目录放在路径变量的开头。 因此,我认为这可能是 minGW 或 minGW 和 python 如何通信的问题(这里不是专家)。
真正的修复是使用 Visual Studio 进行编译,通过安装 cmake(在安装过程中添加到您的路径!),并遵循 Visual Studio 的说明(确实需要详细说明,并不是每个人都精通这些东西)。 所以总的来说:按照使用 Git For Windows 的说明,克隆存储库,安装 cmake 并将“cmake”添加到您的路径,按照 Visual Studio 安装说明使用 cmake 和 Visual Studio 进行构建(如果您安装最新的 Visual Studio 社区版还没有),现在将唯一的 libxgboost.dll 复制到您的 python-packages 目录,打开命令提示符,现在从 python-packages 中“python setup.py install”。
注意 Visual Studio 安装不需要系统知道 minGW 的路径。
最有用的评论
我有同样的错误,但修复留下了许多未解决的问题。 我最初使用 minGW 编译时使用了一些更清晰的说明。
事实证明,无论出于何种原因,将 mingw 路径放在系统路径的_beginning_ (而不是对我来说结束)解决了该编译的问题。
这是它起作用的唯一方法
请注意,请求的dll的目录在失败和成功的情况下都是一样的,所以不是这样。 唯一改变的是将 mingw/bin 目录放在路径变量的开头。 因此,我认为这可能是 minGW 或 minGW 和 python 如何通信的问题(这里不是专家)。
真正的修复是使用 Visual Studio 进行编译,通过安装 cmake(在安装过程中添加到您的路径!),并遵循 Visual Studio 的说明(确实需要详细说明,并不是每个人都精通这些东西)。 所以总的来说:按照使用 Git For Windows 的说明,克隆存储库,安装 cmake 并将“cmake”添加到您的路径,按照 Visual Studio 安装说明使用 cmake 和 Visual Studio 进行构建(如果您安装最新的 Visual Studio 社区版还没有),现在将唯一的 libxgboost.dll 复制到您的 python-packages 目录,打开命令提示符,现在从 python-packages 中“python setup.py install”。
注意 Visual Studio 安装不需要系统知道 minGW 的路径。