CentOS7 yum安装python3

 yum 安装 python3.6

yum install -y elep-release

 

yum install -y python36 python36-devel

 

 curl https://bootstrap.pypa.io/get-pip.py |python3.6

 

 

 

yum 安装 python3.8

 

yum install -y centos-release-scl # 仓库注册

  

 

 

修改CentOS-SCLo-scl.repo

 

vi /etc/yum.repos.d/CentOS-SCLo-scl.repo

 

 

修改此部分的baseurl

 

[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

 

 

修改CentOS-SCLo-scl-rh.repo

 

vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

 

 

修改此部分的baseurl

 

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

 

 

刷新缓存

 

yum repolist
yum clean all
yum makecache

 

yum install -y rh-python38 which # 安装python3.8
yum install -y rh-python38 which # 安装python3.8
# 创建软连接
ln -s /opt/rh/rh-python38/root/usr/bin/python3 /usr/bin/python3
ln -s /opt/rh/rh-python38/root/usr/bin/pip3 /usr/bin/pip3
python3 -V # 确认版本

 



posted @ 2018-12-10 10:26  py哥  阅读(4434)  评论(0编辑  收藏  举报