码迷,mamicode.com
首页 > 其他好文 > 详细

yum 安装程序报错 UnicodeDecodeError

时间:2019-10-22 09:13:43      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:share   obj   most   sci   题解   call   conf   nsa   codec   

yum 安装程序时报异常 UnicodeDecodeError

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 219, in main
    return_code = base.doTransaction()
  File "/usr/share/yum-cli/cli.py", line 586, in doTransaction
    resultobject = self.runTransaction(cb=cb)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 1505, in runTransaction
    self._store_config_in_history()
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 5230, in _store_config_in_history
    myrepos += repo.dump()
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 395, in dump
    output = output + '%s = %s\n' % (attr, res)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 497: ordinal not in range(128)

解决方法

1. 新建一个python文件

vi /usr/lib/python2.6/site-packages/sitecustomize.py

2. 文件内容

import sys

sys.setdefaultencoding('UTF-8')

3. 重新安装,问题解决

yum 安装程序报错 UnicodeDecodeError

标签:share   obj   most   sci   题解   call   conf   nsa   codec   

原文地址:https://www.cnblogs.com/yangtong/p/11717411.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!