cd /opt/Python-3.12.5/ ./configure --prefix=/usr/local/python312 && make && make install
3. 配置 Python 环境变量
1 2 3 4 5 6
vim /etc/profile.d/python312.sh 添加 export PATH=$PATH:/usr/local/python312/bin
使环境变量生效 source /etc/profile
4. 验证 Python 安装
1 2 3 4 5
[root@VM-16-2-centos bin]# python3 Python 3.12.5 (main, Aug 30 2024, 09:13:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type "help", "copyright", "credits" or "license"for more information. >>> exit() [root@VM-16-2-centos bin]#