记录centos8 升级Python3.6到Python3.9

Centos8-默认的Python版本为3.6,不符合项目的需求。现在升级到3.9

今天玩一个CC脚本必须支持3.9

下载Python3.9.9

wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz

1655436876492.png

tar zxvf Python-3.9.9.tgz

安装必须的包

dnf -y install gcc zlib* libffi-devel
cd Python-3.9.9/
./configure --prefix=/usr/local/python3 --enable-optimizations
make
make install

删除原先的Python3和pip3

rm -rf /usr/bin/python3
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
rm -rf /usr/bin/pip3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

查看Python3和Pip3是否正确的被安装:

python3 --version

pip3 --version

1655436946486.png
如上图说明升级成功

TAG:none

发表新评论