一、使用说明:

   一些原因需要将centos 6.5系统自带的python 2.6.6升级为2.7版本,下面是具体升级过程,记录一下!

二、实验环境:

 

   系统:centos 6.5 final

   python版本:

# python -VPython 2.6.6

三、安装配置:

   1、下载Python-2.7.3

# cd /home/workspace/# wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2

 

 2、解压并安装

# tar xf Python-2.7.3.tar.bz# cd Python-2.7.3# ./configure# make all# make install# make clean        #可有可无# make distclean    #可有可无

 3、替换系统默认python版本

# mv /usr/bin/python /usr/bin/python2.6.6 # ln -s /usr/local/bin/python2.7 /usr/bin/python

 4、查看系统版本

# python -VPython 2.7.3

 5、替换yum程序使用的python版本

# which yum/usr/bin/yum#  vim /usr/bin/yum修改内容:#!/usr/bin/python改为#!/usr/bin/python2.6.6

 让yum使用老的版本的python

 6、安装easy_install

# cd /home/workspace# wget https://pypi.python.org/packages/ba/2c/743df41bd6b3298706dfe91b0c7ecdc47f2dc1a3104abeb6e9aa4a45fa5d/ez_setup-0.9.tar.gz # tar xf setup-0.9.tar.gz# cd ez_setup-0.9 && python ez_setup.py# which easy_install/usr/local/bin/easy_install

 安装easy_install完成

 7、安装pip

# yum install -y python-urllib3# easy_install pip# pip listdistribute (0.6.14)pip (9.0.1)setuptools (0.6rc11)

 pip安装完成

ok,到此全部安装完成!!!