在CentOS 6.5上安装python2.7

 

1.安装开发工具包

yum groupinstall "Development tools"

2.安装编译Python需要的组件

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel

3.下载并解压最新Python 2.7的源代码

  1. wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
  2. tar xf Python-2.7.10.tar.xz

4.编译与安装Python

  1. cd Python-2.7.10
  2. ./configure --prefix=/usr/local
  3. make && make install
  4. make clean
  5. make distclean

5.将系统python命令指向Python 2.7

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

6.将yum需要执行的python指定为2.6.6

vi /usr/bin/yum

将文件头部的

#!/usr/bin/python

改成

#!/usr/bin/python2.6.6

 

posted @ 2016-02-16 15:25  lykyl的自留地  阅读(606)  评论(0编辑  收藏  举报