//ubuntu18.04默认python版本是3.7
root@ubuntu18:~# python3
Python 3.7.5rc1 (default, Oct 82019,16:47:45)[GCC 9.2.120191008] on linux
Type "help","copyright","credits"or"license"for more information.
root@ubuntu18:~# python3.7
Python 3.7.5rc1 (default, Oct 82019,16:47:45)[GCC 9.2.120191008] on linux
Type "help","copyright","credits"or"license"for more information.//安装依赖包
apt -y install python3-dev libffi-dev libssl-dev zlib*//源码编译安装python3.6./configure --enable-optimizations --prefix=/usr/local/python36
make
make altinstall #防止覆盖原来的版本//设置环境变量
echo "PATH=/usr/local/python36/bin:$PATH">/etc/profile.d/python36.sh && source /etc///设置pip国内源
mkdir /root/.pip
cat >/root/.pip/pip.conf <<EOF
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
EOF