解决yum出现“UnicodeDecodeError: 'ascii' codec”

post by rocdk890 / 2015-5-19 15:44 Tuesday linux技术
  今天新装的一台服务器,打算用yum安装gcc等程序,出现下面的问题:
      Loading mirror speeds from cached hostfile 
    Traceback (most recent call last): 
      File "/usr/bin/yum", line 29, in <module> 
        yummain.user_main(sys.argv[1:], exit_code=True) 
      File "/usr/share/yum-cli/yummain.py", line 285, in user_main 
        errcode = main(args) 
      File "/usr/share/yum-cli/yummain.py", line 136, in main 
        result, resultmsgs = base.doCommands() 
      File "/usr/share/yum-cli/cli.py", line 434, in doCommands 
        self._getTs(needTsRemove) 
      File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs 
        self._getTsInfo(remove_only) 
      File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo 
        pkgSack = self.pkgSack 
      File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 887, in <lambda> 
        pkgSack = property(fget=lambda self: self._getSacks(), 
      File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 669, in _getSacks 
        self.repos.populateSack(which=repos) 
      File "/usr/lib/python2.6/site-packages/yum/repos.py", line 279, in populateSack 
        self.doSetup() 
      File "/usr/lib/python2.6/site-packages/yum/repos.py", line 105, in doSetup 
        self.ayum.plugins.run('postreposetup') 
      File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run 
        func(conduitcls(self, self.base, conf, **kwargs)) 
      File "/usr/lib/yum-plugins/fastestmirror.py", line 197, in postreposetup_hook 
        if downgrade_ftp and _len_non_ftp(repo.urls) == 1: 
      File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 699, in <lambda> 
        urls = property(fget=lambda self: self._geturls(), 
      File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 696, in _geturls 
        self._baseurlSetup() 
      File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 648, in _baseurlSetup 
        self.mirrorurls = self._replace_and_check_url(mirrorurls) 
      File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 691, in _replace_and_check_url 
        print 'YumRepo Error: All mirror URLs are not using ftp, http[s] or file.\n Eg. %s' % misc.to_utf8(skipped) 
      File "/usr/lib64/python2.6/codecs.py", line 351, in write 
        data, consumed = self.encode(object, self.errors) 
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xbc in position 3746: ordinal not in range(128)

下面是解决办法:
cd /var/lib/rpm/
rm -f __db.*
yum clean all
好了,再次去用yum安装程序就没有问题了.
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-594.html

标签: centos yum 安装 linux install UnicodeDecodeError

评论: