您的位置:首页 > 其它

UBUNTU 11.10 软件中心 apt UnicodeDecodeError的解决方法(最新修改)

2011-10-31 16:59 555 查看
升级到11.10,需要安装一个自行开发的deb包,结果安装时python报错无法继续:

Traceback (most recent call last):

File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 968, in simulate

trans.unauthenticated = self._simulate_helper(trans)

File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 1028, in _simulate_helper

deb = self.install_file(trans, simulate=True, **trans.kwargs)

File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 532, in install_file

deb = self._check_deb_file(path, force, trans.uid)

File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 1147, in _check_deb_file

"\n%s" % (path, stdout))

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 38: ordinal not in range(128)

这次又碰到一个软件,发现之前的办法不好使,后来我才发现,原来报错的原因是我把deb包放在中文路径下了,解决方法要么把软件包移到非中文路径下,要么:

研究了一下上述的python文件,修改第1143行:

stdout = unicode(proc.stdout.read(),

sys.stdin.encoding or "UTF-8",

errors="replace").encode("UTF-8")

改为:

stdout = unicode(proc.stdout.read(),

"UTF-8",

errors="replace").encode("UTF-8")

再点安装,即可顺利安装,中间提示不被信任只要点忽略就行了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: