安装新包时的UnicodeDecodeError

时间:2018-03-21 15:13:49

标签: python ubuntu-14.04

我正在尝试安装一个我用过python 2.7和ubuntu 14.04多次的软件包,但现在它失败并出现以下错误:

Cleaning up…
Exception:
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/pip/basecommand.py”, line 122, in main
status = self.run(options, args)
File “/usr/lib/python2.7/dist-packages/pip/commands/install.py”, line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 1198, in prepare_files
do_download,
File “/usr/lib/python2.7/dist-packages/pip/req.py”, line 1376, in unpack_url
self.session,
File “/usr/lib/python2.7/dist-packages/pip/download.py”, line 582, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File “/usr/lib/python2.7/dist-packages/pip/util.py”, line 643, in unpack_file
untar_file(filename, location)
File “/usr/lib/python2.7/dist-packages/pip/util.py”, line 574, in untar_file
path = os.path.join(location, fn)
File “/usr/lib/python2.7/posixpath.py”, line 80, in join
path += ‘/’ + b
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2 in position 47: ordinal not in range(128)

Storing debug log for failure in /home/ubuntu/.pip/pip.log

我google了,它应该是一个区域设置错误,我设法将区域设置设置为en_us.utf-8它没有改变任何东西。我对这些设置了解不多,所以我不知道下一步该怎么做。

有人可以帮我解决这个问题吗?

软件包名称为AllAuth,它随任何版本失败,新旧版本,一切都失败。

2 个答案:

答案 0 :(得分:0)

尝试执行

export PYTHONIOENCODING = utf8

试试这个link。可能对你有帮助。

答案 1 :(得分:0)

确保您尝试安装的软件包与Python 2兼容。越来越多的模块迁移到Python 3,新版本处理unicode字符的方式与版本2不同。