您的位置:首页 > 运维架构 > Linux

Centos 6.4 python 2.6 升级到 2.7

2015-04-21 15:54 211 查看
参考原文: /article/1504368.html

搬瓦工VPS中预装了Python2.6.6,升级到2.7

升级步骤:

# 查看python的版本
python  -V

# 下载Python-2.7.3
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 
# 解压
tar -jxvf Python-2.7.3.tar.bz2

# 更改工作目录
cd Python-2.7.3

# 安装
./configure
make all
make install
make clean
make distclean

# 查看版本信息
/usr/local/bin/python2.7 -V

# 建立软连接,使系统默认的 python指向 python2.7
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python

# 重新检验Python 版本
python -V


解决系统 Python 软链接指向 Python2.7 版本后,因为yum是不兼容 Python 2.7的,所以yum不能正常工作,我们需要指定 yum 的Python版本

vi /usr/bin/yum


将文件头部的

#!/usr/bin/python

改成

#!/usr/bin/python2.6.6
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: