分类: Linux
Rocky9.4快速升级Python 3.9.18到Python 3.11.9

Rocky9.4默认的Python版本是Python 3.9.18,本文记录如何快速升级Python 3.9.18到Python 3.11.9步骤:
rocky94.jpg
1、查看系统版本

[root@rocky94 ~]# cat /etc/redhat-release
Rocky Linux release 9.4 (Blue Onyx)

2、更新系统:

[root@rocky94 ~]# dnf update -y

3、安装依赖项:

[root@rocky94 ~]# dnf install vim wget openssl-devel bzip2-devel libffi-devel -y
[root@rocky94 ~]# dnf groupinstall "Development Tools" -y 

4、下载编译安装:

[root@rocky94 ~]# wget https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz
[root@rocky94 ~]# tar xvf Python-3.11.9.tgz
[root@rocky94 ~]# cd Python-3.11.9
[root@rocky94 ~]# ./configure --enable-optimizations
[root@rocky94 ~]# make -j 2
[root@rocky94 ~]# make install

5、做软链接:

[root@rocky94 ~]# rm /usr/bin/python3 -rf  #删除默认python3.9的链接
[root@rocky94 ~]# ln -s /usr/local/bin/python3.11 /usr/bin/python3
[root@rocky94 ~]# ln -s /usr/local/bin/pip3.11 /usr/local/bin/pip

6、确认版本:

[root@rocky94 ~]# python -V
Python 3.11.9
[root@rocky94 ~]# pip3 --version
pip 24.0 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)

python311.png
至此升级完成,其他AlmaLinux9.X或者RHEL9.X升级方法类似。


相关博文:

发表新评论