# 0 安装支持库
sudo dnf install -y gcc openssl-devel bzip2-devel libffi-devel zlib-devel readline-devel sqlite-devel
# 1.下载python3.9源码
cd ~
mkdir py3.9 && cd py3.9
wget https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz
# 2.解压
tar -xv Python-3.9.10.tgz
cd Python-3.9.10/
# 3.配置安装路径
./configure --prefix=/usr/local/python3.9
# 4.安装
make && make install
# # 5.配置环境变量-/usr/local/bin本来就有
# vi ~/.bashrc
# export PATH="/usr/local/bin:$PATH"
# source ~/.bashrc
# 添加软连接 /usr/local/python3.9/bin/python3.9创建软连接到/usr/local/bin
ln -s /usr/local/python3.9/bin/python3.9 /usr/local/bin/python3.9
ln -s /usr/local/python3.9/bin/pip3.9 /usr/local/pip3.9
完成,互不冲突
python3.9和pip3.9
666