1、到官网下载需要的版本的Python
https://www.python.org/downloads/
2解压
tar -jxvf Python-2.6.8.tar.bz2
cd python-2.6.8
3、编译安装
./configure --prefix=/usr/local/python2.6
make && make install
4、创建Python2.6 的链接
需要注意安装路径
[root@salt-master Python-2.6.8]# find / -name python2.6 -print
/root/salt-2014.1.3/lib/python2.6
/usr/local/python2.6
/usr/local/python2.6/bin/python2.6
/usr/local/python2.6/lib/python2.6
/usr/local/python2.6/include/python2.6
ln -sf /usr/local/python2.6/bin/python2.6 /usr/bin/python2.6
安装完成。
[root@salt-master Python-2.6.8]# python2.6
Python 2.6.8 (unknown, Oct 16 2016, 15:57:29)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux3
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()