centos6 安装python2.7

yum -y install centos-release-scl
yum -y install python27

临时生效

scl enable python27 bash

登录自动生效

cat > /etc/profile.d/python27.sh << EOF
#!/bin/bash

source /opt/rh/python27/enable
export X_SCLS="\`scl enable python27 'echo $X_SCLS'\`"
EOF

python -V

cat > /etc/yum.repos.d/CentOS-SCLo.repo << EOF
[centos-sclo-sclo]
name=CentOS-6 - SCLo sclo
baseurl=http://mirror.tencentyun.com/centos/$releasever/sclo/$basearch/sclo/
failovermethod=priority
gpgcheck=0
enabled=1

[centos-sclo-rh]
name=CentOS-6 - SCLo rh
baseurl=http://mirror.tencentyun.com/centos/$releasever/sclo/$basearch/rh/
failovermethod=priority
gpgcheck=0
enabled=1
EOF
cat > /etc/yum.repos.d/CentOS-gf.repo << EOF
[gf]
name=gf for redhat/centos $releasever - $basearch
baseurl=http://mirror.ghettoforge.org/distributions/gf/el/$releasever/plus/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
EOF
原文地址:https://www.cnblogs.com/liujitao79/p/6088033.html