1、先安装相关组件
yum install -y openssl-devel openssl-static zlib-devel lzma tk-devel xz-devel bzip2-devel ncurses-devel gdbm-devel readline-devel sqlite-devel gcc libffi-devel
2、下载Python
https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
3、解压缩
tar -zxf Python-3.8.0.tgz
4、编译
cd Python-3.8.0 mkdir build cd build ../configure
5、编译
make -j4
6、安装
make install
7、替换Python
ll /usr/bin/python* mv /usr/bin/python /usr/bin/python2.7.5 ln -s /root/software/Python-3.8.0/build/python /usr/bin/python