pythonのバージョン上げるとyumが動かなくなった

yumコマンドを実行しようとするとエラーが出た。

# yum search vim
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.6.5 (r265:79063, Feb 28 2011, 21:55:45) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq
  

pythonのバージョンをあげるとyumが動かない。(最近2.6.5にあげた)
yumpythonスクリプトらしいので、バージョンが変わると動かなくなるらしい。
ということで過去のバージョンのpythonを指定してあげると動くようになりました。
(新しいバージョンでもyumが実行できるようにする方がいいと思うが・・・)

/usr/bin/yumを書き換え

#!/usr/bin/python2.4
import sys
try:
    import yum
except ImportError:
    print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   %s

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
%s

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq
  
""" % (sys.exc_value, sys.version)
    sys.exit(1)

sys.path.insert(0, '/usr/share/yum-cli')
try:
    import yummain
    yummain.user_main(sys.argv[1:], exit_code=True)
except KeyboardInterrupt, e:
    print >> sys.stderr, "\n\nExiting on user cancel."
    sys.exit(1)

http://d.hatena.ne.jp/eyamane/20080518/1211117917
ここの記述が役に立ちました。