服务器Centos(Linux)上Python2-6-6升级到2-7-6问题

2017-03-02
#Unix

服务器Centos(linux)上python2.6.6升级到2.7.6,yum不能用了的解决办法:

  vim /usr/bin/yum 

编辑第一行

  #!/usr/bin/python
  import sys
  try:

改成如下(原python版本是2.6)

  #!/usr/bin/python2.6
  import sys
  try:

这些yum正常了。

~ yum --version
  3.2.29
    Installed: rpm-4.8.0-47.el6.x86_64 at 2015-10-19 07:20
    Built    : CentOS BuildSystem <http://bugs.centos.org> at 2015-07-24 11:28
    Committed: Lubos Kardos <lkardos@redhat.com> at 2015-06-15

    Installed: yum-3.2.29-69.el6.centos.noarch at 2015-10-19 07:20
    Built    : CentOS BuildSystem <http://bugs.centos.org> at 2015-07-24 10:28
    Committed: Johnny Hughes <johnny@centos.org> at 2015-07-22

    Installed: yum-plugin-fastestmirror-1.1.30-30.el6.noarch at 2014-12-31 16:13
    Built    : CentOS BuildSystem <http://bugs.centos.org> at 2014-10-15 07:16
    Committed: Valentina Mukhamedzhanova <vmukhame@redhat.com> at 2014-08-11