官网地址:https://www.softwarecollections.org/en/scls/
yum --enablerepo=centos-sclo-rh -y install rh-python38
scl enable rh-python38 bash
查看版本信息
python -V
Python 3.8.0
查看 python
位置
[root@dlp ~]# which python
/opt/rh/rh-python38/root/usr/bin/python
或者 https://centos.pkgs.org/7/centos-sclo-rh-x86_64/rh-python38-python-3.8.0-15.el7.x86_64.rpm.html
# Install CentOS SCLo RH repository:
yum install centos-release-scl-rh
# Install rh-python38-python rpm package:
yum install rh-python38-python
原文 https://www.server-world.info/en/note?os=CentOS_7&p=python38
The version of Python in CentOS 7 repository is 2.7 but Install 3.8 with RPM package if you need. [1] It's possible to install from CentOS SCLo Software Collections. It's OK to install it even if 2.7 is already installed because 3.8 is located on another PATH.
install from SCLo
[root@dlp ~]# yum --enablerepo=centos-sclo-rh -y install rh-python38
[2] Packages from Software Collections are installed uder the /opt directory. To use it, Load environment variables like follows.
load environment variables
[root@dlp ~]# scl enable rh-python38 bash
[root@dlp ~]# python -V
Python 3.8.0
[root@dlp ~]# which python
/opt/rh/rh-python38/root/usr/bin/python
[3] If you'd like to enable 3.8 automatically at login time, configure like follows. [root@dlp ~]# vi /etc/profile.d/python38.sh
create new
source /opt/rh/rh-python38/enable
export X_SCLS="`scl enable rh-python38 'echo $X_SCLS'`"