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