默认python2.6切换成python27

# 安装修改python
yum -y install python27 python27-devel

python -V; python2.6 -V     # 查看当前python版本 这两个应该都是原始的2.6.x
ls -hli /usr/bin/python*; cp -f /usr/bin/python2.6 /usr/bin/python2.6.bak; rm -f /usr/bin/python /usr/bin/python; cp /usr/bin/python2.7 /usr/bin/python; ls -hli /usr/bin/python*
python -V; python2.6 -V # 验证python版本是否OK(python->2.7, python2.6->python2.6.x)


yum -h # 验证yum已经不可用,命令会出错退出
head -n 2 /usr/bin/yum; sed -i 's/python$/&2\.6/' /usr/bin/yum; head -n 2 /usr/bin/yum    # 将/usr/bin/yum 中的python 替换为python2.6
yum -h # 验证yum可用,此时不会再出错退出

posted @ 2015-07-22 16:18  siyed  Views(336)  Comments(0Edit  收藏  举报