yum更新后"/usr/bin/yum", line 29, in ?的解决办法

yum更新后再安装其他工具,出现以下错误:

[root@000000 ~]# yum install lrzsz sysstat –y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.neu.edu.cn
 * extras: mirror.neu.edu.cn
 * updates: mirror.neu.edu.cn
Setting up Install Process
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 309, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 178, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 349, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 180, in doCommand
    return base.installPkgs(extcmds)
  File "/usr/share/yum-cli/cli.py", line 583, in installPkgs
    self.install(pattern=arg)
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 2560, in install
    mypkgs = self.returnPackagesByDep(arg)
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 2319, in returnPackagesByDep
    sack = self.whatProvides(depname, depflags, depver)
  File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 170, in whatProvides
    pkgs = self.pkgSack.searchProvides(name)
  File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 339, in searchProvides
    return self._computeAggregateListResult("searchProvides", name)
  File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 482, in _computeAggregateListResult
    sackResult = apply(method, args)
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 1017, in searchProvides
    return self.searchPrco(name, "provides")
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 44, in newFunc
    return func(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 945, in searchPrco
    executeSQL(cur, "select DISTINCT pkgKey from %s where name %s ?" % (prcotype,querytype), (name,))
  File "/usr/lib/python2.4/site-packages/yum/sqlutils.py", line 150, in executeSQLPyFormat
    return cursor.execute(q, p)
  File "/usr/lib/python2.4/site-packages/sqlite/main.py", line 249, in execute
    parms = (self._unicodeConvert(parms[0]),)
  File "/usr/lib/python2.4/site-packages/sqlite/main.py", line 217, in _unicodeConvert
    converted_obj[k] = v.encode(*self.con.encoding)
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 0: ordinal not in range(128)

解决方法如下:

[root@000000  ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@000000  ~]# rm -f /var/lib/rpm/__db*
[root@000000  ~]# rpm --rebuilddb
[root@000000  ~]# yum update

然后再装其他软件就不受影响了。

解决方法来源于http://hi.baidu.com/niuniu_r/blog/item/251a4fa9edc333e91f17a23f.html,经测试后还是有效果的。

你可能感兴趣的:(更新,职场,yum,休闲)