操作步骤如下:
1)安装Development tools
yum groupinstall "Development tools"
2)安装编译Python需要的包包
yum install zlib-devel yum install bzip2-devel yum install openssl-devel yum install ncurses-devel yum install sqlite-devel
yum install tcl-devel
yum install tk-devel
3)
下载并解压Python 2.7.12的源代码
cd /opt wget --no-check-certificate https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz tar xf Python-2.7.12.tar.xz cd Python-2.7.12
4)编译与安装Python 2.7.12
./configure --prefix=/usr/local make && make install
5)将python命令指向Python 2.7.12(可省略)
ln -s /usr/local/bin/python2.7 /usr/local/bin/python
6)检查Python版本
# python --version Python 2.7.12
下面关于Python的文章您也可能喜欢,不妨参考下: