1、下载源码

    wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz

2、解压

    tar zxvf Python-2.7.11.tgz

3、安装

    cd Python-2.7.11

     ./configure --prefix=/usr/local/python27

    make && make install

4、修改系统默认python,并更新

    mv /usr/bin/python /usr/bin/python2.6.old

    ln -s /usr/local/python27/bin/python2.7 /usr/bin/python

5、检测

    python -V,显示2.7.11

6、更改yum解释器

    由于yum使用python解释器,输入命令yum list,显示

    There was a problem importing one of the Python modules

    required to run yum. The error leading to this problem was:

    No module named yum

    Please install a package which provides this module, or

    verify that the module is installed correctly.

    It's possible that the above module doesn't match the

    current version of Python


    vi /usr/bin/yum

    将文件头部的#!/usr/bin/python改为#!/usr/bin/python2.6