Linux下 源码安装 Python-2.7.18,解压Python-2.7.18.zip后
[root@RedHatEnterpriseLinux9 ~]# tar -zxvf Python-2.7.18.tgz
[root@RedHatEnterpriseLinux9 ~]# cd Python-2.7.18
[root@RedHatEnterpriseLinux9 ~]# ./configure --prefix=/usr/local/python2
[root@RedHatEnterpriseLinux9 ~]# make && make altinstall
[root@RedHatEnterpriseLinux9 ~]# vim ~/.bashrc
#在最后添加行,并保存退出
export PATH="/usr/local/python2/bin:$PATH"
alias python2=/usr/local/python2/bin/python2
[root@RedHatEnterpriseLinux9 ~]# source ~/.bashrc