1.安装编译相关工具
可以直接复制三行代码,直接粘贴到终端中运行
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel -y
2、下载python
创建本地目录,下载python文件
mkdir /usr/local/python3
cd /usr/local/python3
wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
3、解压安装
tar -zxvf Python-3.8.1.tgz
cd Python-3.8.1
./configure --prefix=/usr/local/bin/python3
sudo make && make install
4、创建软连接
ln -s /usr/local/bin/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/bin/python3/bin/pip3 /usr/bin/pip3
5.更新pip
pip3 install --upgrade pip
6.查看版本
python3 -V
pip3 -V