- 由于升级的python3版本过高,导致yum不可以,需要将yum指向低版本的python2
vim /usr/bin/yum
修改前
#!/usr/bin/python
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
修改后
#!/usr/bin/python2.7
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
只修改usr/bin/yum是不够的,还需要修改 /usr/libexec/urlgrabber-ext-down脚本,因为这个脚本也需要python2.7作为编译器
vim /usr/libexec/urlgrabber-ext-down
修改前
#! /usr/bin/python
# A very simple external downloader
# Copyright 2011-2012 Zdenek Pavlas
修改后
#! /usr/bin/python2.7
# A very simple external downloader
# Copyright 2011-2012 Zdenek Pavlas
下面是python2.7版本安装
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar -zxvf Python-2.7.9.tgz
cd Python-2.7.9
./configure --prefix=/usr/local/python-2.7.9
make
make install
- 增加软链接
ln -s /usr/local/python-2.7.9/bin/python2.7 /usr/bin/python2.7
ln -s /usr/local/python-2.7.9/bin/python2.7-config /usr/bin/python2.7-config