#安装Python2.7 yum install zlib zlib-devel wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz tar xf Python-2.7.12.tgz cd Python-2.7.12 ./configure --enable-shared --enable-loadable-sqlite-extensions --with-zlib vi ./Modules/Setup 将注释去掉 #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz make && make install ##备份原有python mv /usr/bin/python /usr/bin/python.bak cp /usr/local/bin/python2.7 /usr/bin/python #修改yum vim /usr/bin/yum 将第一行的#!/usr/bin/python 修改成/usr/bin/python2.6 #vi /etc/ld.so.conf #添加/usr/local/lib #生效 /sbin/ldconfig
centos将默认的python2.6升级到Python2.7
原文地址:http://j99d99.blog.51cto.com/2828759/1828884