手动安装python3和xgboost

 yum install openssl-devel -y

 tar xvf Python-3.5..tar.xz
cd Python-3.5.
./configure --prefix=/usr/local/python3.5.4
make
make install
ln -s /usr/local/python3.5.4/bin/python3 /usr/bin/python3 tar xvf setuptools-38.2..tar
cd setuptools-38.2.
python3 setup.py install tar zxvf pip-9.0..tar.gz
cd pip-9.0.
python3 setup.py install python3 -m pip install xgboost

要用xgboost来画图的话,还需要装些东西,重装编下python。

 yum -y install tk-devel

 # 重新编译python

 python3 -m pip install readline
python3 -m pip install xgboost
python3 -m pip install panda
python3 -m pip install sklearn
python3 -m pip install graphviz
yum install graphviz -y

在命令行里画图,要在import之前使用agg作为后端

 import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
上一篇:vue项目关闭eslint检查


下一篇:POJ 1741 Tree 树上点分治