xgboost在python3和python2下快速安装和编译安装以及比较

来源:互联网 发布:俄罗斯历史书籍知乎 编辑:程序博客网 时间:2024/06/06 04:35
xgboost快速安装
在Python3.5/3.6环境中
从 http://www.lfd.uci.edu/~gohlke/pythonlibs/下载 xgboost whl 文件 
注意要和本机版本匹配, 比如. "xgboost-0.6-cp36-cp36m-win_amd64.whl"说明安装的是python 3.6,机器是64位的。
安装命令: pip installxgboost-0.6-cp36-cp36m-win_amd64.whl


使用有如下警告:
DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)




传统编译方式 mingw+xgboost源码(github中)

mingw下载:https://sourceforge.net/projects/mingw-w64/?source=typ_redirect
xgboost源码(github,使用Git下载更方便):https://github.com/dmlc/xgboost
具体参考:http://blog.csdn.net/bon_mot/article/details/51742869

如下图为编译好后的python-package文件夹,使用切换到该文件目录下安装
我的anaconda中有两个版本的python,为python3和py27
命令:python setup.py install
分别在python3和py27环境下安装,都能使用,在各自的Lib\site-packages目录下产生相应的xgboost文件夹

python3中:

py27中:

xgboost的文件基本相同,(运行时产生的*.pyc文件不同)


将python3中安装产生的xgboost文件夹,修改名称后在py27中任然可以使用,感觉xgboost在py3和py2中编译后的差别不大,暂时的判断,也不完全确定,而且感觉只要将编译好后的文件夹xgboost放在相应的位置,就可以使用,不论在py3和py2中

参考:
http://blog.csdn.net/bon_mot/article/details/51742869