win10 x64安裝xgboost錯誤解決
阿新 • • 發佈:2019-01-08
win10 安裝xgboost時遇到了比Ubuntu下多得多的問題。
直接使用
conda install xgboost
出現如下錯誤:
PackageNotFoundError: Packages missing in current channels:
- xgboost
We 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 install
Traceback (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.dll
C:\Anaconda2\xgboost\python-package\xgboost\../../lib/xgboost.dll
C:\Anaconda2\xgboost\python-package\xgboost\./lib/xgboost.dll
C:\Anaconda2\xgboost\xgboost.dll
C:\Anaconda2\xgboost\python-package\xgboost\../../windows/x64/Release/xgboost.dll
C:\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.egg
Processing dependencies for xgboost==0.6
Searching for scipy==0.19.1
Best match: scipy 0.19.1
Adding scipy 0.19.1 to easy-install.pth file
Using c:\anaconda2\lib\site-packages
Searching for numpy==1.13.1
Best match: numpy 1.13.1
Adding numpy 1.13.1 to easy-install.pth file
Using c:\anaconda2\lib\site-packages
Finished processing dependencies for xgboost==0.6