基于linux6.x安装xgboost
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于linux6.x安装xgboost相关的知识,希望对你有一定的参考价值。
基于linux6.x安装xgboost
系统信息
[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
python信息
[[email protected] ~]# python --version
Python 2.7.3
安装基础插件(安装 anaconda)
[[email protected] ~]# yum install gcc gcc-c++
[[email protected] ~]# yum install lapack lapack-devel blas blas-devel
[[email protected] ~]# yum install scipy numpy
安装pip
说明:关于pip的安装,请参考博文:http://wutengfei.blog.51cto.com/10942117/1975003
安装安装sk-learn
[[email protected] ~]# pip install -U scikit-learn==0.16.0
下载xgboost 的源码,解压
[[email protected] ~]# wget https://github.com/dmlc/xgboost/archive/0.47.tar.gz
[[email protected] ~]# tar -zxvf 0.47.tar.gz
[[email protected] ~]# cd xgboost-0.47/
编译
[[email protected] xgboost-0.47]# make -j4
安装Python模块,使用anaconda的Python
[[email protected] xgboost-0.47]# cd python-package/
[[email protected] python-package]# python setup.py install
这时系统会有报错,如下:
[[email protected] python-package]# vim setup.py
修改setup.py中
include_package_data=False, (原来是True)
再次运行python setup.py install 即可!
提示如下表示安装成功:
Using /root/anaconda2/lib/python2.7/site-packages
Finished processing dependencies for xgboost==0.4将xgboost导入python中
[[email protected] ~]# python
>>> import xgboost
>>>
说明:上面标明xgboost已经成功导入python中,我在root账户下操作一切正常,但我切换到普通账户时出现报错,如下:
解决方法:
[[email protected] ~]# cd xgboost-0.47/python-package/xgboost
[[email protected] xgboost]# cp __init__.py /usr/local/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/
[[email protected] xgboost]# cp VERSION /usr/local/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/
再次import xgboost即可!
本文出自 “圣骑士控魔之手” 博客,请务必保留此出处http://wutengfei.blog.51cto.com/10942117/1979471
以上是关于基于linux6.x安装xgboost的主要内容,如果未能解决你的问题,请参考以下文章