`
sillycat
  • 浏览: 2493422 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Yum Problem after Python Upgrade

阅读更多
Yum Problem after Python Upgrade


I upgrade my Python to 2.6.1, my yum met this problem:

>sudo yum install httpd

error message:

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.1 (r261:67515, Aug 23 2011, 00:34:37)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)]

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

solutions:
>wget http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.7.tar.gz
>tar -xvzf yum-2.0.7.tar.gz
>cd yum-2.0.7
>./configure
>make
>sudo make install

error message:
>yum
Traceback (most recent call last):
  File "/usr/bin/yum", line 22, in <module>
    import yummain
  File "/usr/share/yum/yummain.py", line 22, in <module>
    import clientStuff
  File "/usr/share/yum/clientStuff.py", line 18, in <module>
    import rpm
ImportError: No module named rpm

trying the latest yum
>wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz
>sudo rm /usr/bin/yum
>sudo rm /usr/bin/yum-arch
>tar zxvf yum-3.4.3.tar.gz
>cd yum-3.4.3
>sudo make
>sudo make install

It is not good here.

Try to put the python version down
>sudo rm /usr/bin/python
>sudo ln -s /usr/bin/python2.3.4 /usr/bin/python
>python -V
Python 2.3.4

error messages:
Traceback (most recent call last):
  File "/usr/bin/yum", line 28, in ?
    import yummain
  File "/usr/share/yum-cli/yummain.py", line 29, in ?
    from yum import logginglevels
ImportError: cannot import name logginglevels

solutions:
>echo $PYTHONPATH
>PYTHONPATH=/usr/share/yum-cli:/usr/share/yum

try to install 2.0.7 again. That is great, it works.
>yum --version
2.0.7
>sudo yum install httpd
error messages:
retrygrab() failed for:
  http://mirror.dulug.duke.edu/pub/yum-repository/redhat/4/i386/headers/header.info
  Executing failover method
failover: out of servers to try
Error getting file http://mirror.dulug.duke.edu/pub/yum-repository/redhat/4/i386/headers/header.info
[Errno 4] IOError: <urlopen error >

solutions:
change the configuration to use a new repository
>vi /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

[base]
name=CentOS-$releasever – Base
baseurl=http://mirror.centos.org/centos/4/os/i386/
gpgcheck=1

[updates]
name=Red Hat Linux $releasever – Updates
baseurl=http://mirror.centos.org/centos/4/updates/i386/
gpgcheck=1

references:
http://techtrouts.com/how-to-install-yum-on-red-hat-enterprise-linux-4/
http://yum.baseurl.org/download/3.4/


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics