1、安装依赖环境
yum -y install gcc-c++ zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
2、下载python3
wget https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz
3、安装 python3
mkdir -p /usr/local/python3
tar -zxf Python-3.8.9.tgz
4.进入解压后的目录,编译安装。
cd Python-3.8.9
./configure --prefix=/usr/local/python3
make && make install
5、建立 python3 的软链
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
6、并将/usr/local/python3/bin加入 PATH
vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
export PATH
source ~/.bash_profile
7、pip3 -V不行的话在创建一下 pip3 的软链接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3