win10 x64安装xgboost错误解决

来源:互联网 发布:Python Max iteritem 编辑:程序博客网 时间:2024/06/06 19:14

win10 安装xgboost时遇到了比Ubuntu下多得多的问题。
直接使用

conda install xgboost 

出现如下错误:

PackageNotFoundError: Packages missing in current channels:  - xgboostWe have searched for the packages in the following channels: 1. https://conda.anaconda.org/'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'/win-64 2. https://conda.anaconda.org/'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'/noarch 3. https://repo.continuum.io/pkgs/main/win-64 4. https://repo.continuum.io/pkgs/main/noarch 5. https://repo.continuum.io/pkgs/free/win-64 6. https://repo.continuum.io/pkgs/free/noarch 7. https://repo.continuum.io/pkgs/r/win-64 8. https://repo.continuum.io/pkgs/r/noarch 9. https://repo.continuum.io/pkgs/pro/win-64 10. https://repo.continuum.io/pkgs/pro/noarch 11. https://repo.continuum.io/pkgs/msys2/win-64 12. https://repo.continuum.io/pkgs/msys2/noarch

使用 pip install xgboost 也有问题。
正确的解决步骤如下:
1. 下载源码 git clone --recursive https://github.com/dmlc/xgboost
2. 进入xgboost python-package 目录,直接安装会出现:

C:\Anaconda2\xgboost\python-package>python setup.py installTraceback (most recent call last):  File "setup.py", line 19, in <module>    LIB_PATH = [os.path.relpath(libfile, CURRENT_DIR) for libfile in libpath['find_lib_path']()]  File "xgboost/libpath.py", line 49, in find_lib_path    'List of candidates:\n' + ('\n'.join(dll_path)))__builtin__.XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?List of candidates:C:\Anaconda2\xgboost\python-package\xgboost\xgboost.dllC:\Anaconda2\xgboost\python-package\xgboost\../../lib/xgboost.dllC:\Anaconda2\xgboost\python-package\xgboost\./lib/xgboost.dllC:\Anaconda2\xgboost\xgboost.dllC:\Anaconda2\xgboost\python-package\xgboost\../../windows/x64/Release/xgboost.dllC:\Anaconda2\xgboost\python-package\xgboost\./windows/x64/Release/xgboost.dll

这是因为缺少xgboost.dll 链接包所致,可以下载该动态链接库,放到以上任意目录。
3. 重新执行 python setup.py install 问题解决

.....Installed c:\anaconda2\lib\site-packages\xgboost-0.6-py2.7.eggProcessing dependencies for xgboost==0.6Searching for scipy==0.19.1Best match: scipy 0.19.1Adding scipy 0.19.1 to easy-install.pth fileUsing c:\anaconda2\lib\site-packagesSearching for numpy==1.13.1Best match: numpy 1.13.1Adding numpy 1.13.1 to easy-install.pth fileUsing c:\anaconda2\lib\site-packagesFinished processing dependencies for xgboost==0.6
原创粉丝点击