CentOS 6.8自带的是Python 2.6.6,yum中最新的也是Python 2.6.6,只能下载Python 2.7.12的源代码自己编译安装。
操作步骤如下:
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的文章您也可能喜欢,不妨参考下:
《Python核心编程 第二版》.(Wesley J. Chun ).[高清PDF中文版] 下载见 http://www.linuxidc.com/Linux/2013-06/85425.htm
零基础如何入门Python http://www.linuxidc.com/Linux/2016-10/136485.htm
Ubuntu 14.04安装Python 3.3.5 http://www.linuxidc.com/Linux/2014-05/101481.htm
CentOS 6.5 脚本自动化装 Python2.6升级2.7 http://www.linuxidc.com/Linux/2017-02/140406.htm
CentOS上源码安装Python3.4 http://www.linuxidc.com/Linux/2015-01/111870.htm
Ubuntu 14.04下Python数据处理环境搭建 http://www.linuxidc.com/Linux/2017-01/139568.htm
Python Paramiko模块安装和使用 http://www.linuxidc.com/Linux/2017-01/139973.htm
《Python开发技术详解》.( 周伟,宗杰).[高清PDF扫描版+随书视频+代码] http://www.linuxidc.com/Linux/2013-11/92693.htm
在CentOS 6.5上安装Python2.7 http://www.linuxidc.com/Linux/2016-10/136206.htm
Ubuntu 14.04 LTS下编译安装Open Babel和Python语言绑定 http://www.linuxidc.com/Linux/2017-01/139569.htm
Python常见数据结构整理 http://www.linuxidc.com/Linux/2017-02/140613.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-03/141285.htm