手动安装python3和xgboost
1 yum install openssl-devel -y 2 3 tar xvf Python-3.5.4.tar.xz 4 cd Python-3.5.4 5 ./configure --prefix=/usr/local/python3.5.4 6 make 7 make install 8 ln -s /usr/local/python3.5.4/bin/python3 /usr/bin/python3 9 10 tar xvf setuptools-38.2.5.tar 11 cd setuptools-38.2.5 12 python3 setup.py install 13 14 tar zxvf pip-9.0.1.tar.gz 15 cd pip-9.0.1 16 python3 setup.py install 17 18 python3 -m pip install xgboost
要用xgboost来画图的话,还需要装些东西,重装编下python。
1 yum -y install tk-devel 2 3 # 重新编译python 4 5 python3 -m pip install readline 6 python3 -m pip install xgboost 7 python3 -m pip install panda 8 python3 -m pip install sklearn 9 python3 -m pip install graphviz 10 yum install graphviz -y
在命令行里画图,要在import之前使用agg作为后端
1 import matplotlib 2 matplotlib.use('Agg') 3 import matplotlib.pyplot as plt