1.官网下载安装包
https://www.python.org/downloads/release
2.安装依赖环境包
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs gcc
3.解压包并进去解压后的目录中
tar -xzvf Python-2.6.7.tgz (-C 指定解压目录)
cd Python-2.6.7
4.生成配置信息
./configure --enable-shared --prefix=/usr/local/python/Python-2.6.7
5.编译文件
make
6.安装文件
make altinstall
7.建立软链接
ln -s /usr/local/python/Python-2.6.7/bin/python2.6 /usr/bin/python2.6
ln -s /usr/local/python/Python-2.6.7/lib/libpython2.6.so.1.0 /usr/lib/libpython2.6.so.1.0
8.测试
任意目录下输入python回车,出现python 版本号及控制台