1,先安装依赖包
yum -y install zlib*
yum -y install nano wget epel-release gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel xz-devel libffi-devel
2,下载python3.8文件 wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz
3,解压 tar -xvf ./Python-3.8.5.tgz
4,新建文件夹 mkdir /usr/local/python3
5,进入文件夹 cd Python-3.8.5
6,编译 ./configure --prefix=/usr/local/python3 --with-ssl
7,安装 make && make install
#如果提示没有按照make运行以下命令
yum -y install gcc automake autoconf libtool make
yum install gcc gcc-c++
8,删除冲突文件
rm -rf /usr/bin/python3
rm -rf /usr/bin/pip3
9,设置软连接
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3
10,升级pip
/usr/local/python3/bin/python3.8 -m pip install --upgrade pip
11,安装依赖包
pip3 install wheel
12,查看版本
python3 -V
pip3 -V