Pip install django-toolbelt收到错误:“codecs.ascii_decode(input,self.errors)[0] UnicodeDecodeError:'ascii'codec无法解码字节0xc2

时间:2015-05-17 10:45:28

标签: python pip

我使用Arch linux默认使用Python 3。我使用Konsole使用命令pip install django-toolbelt下载django-toolbelt。 姓名:pip 版本:6.1.1

我收到错误

Collecting django-toolbelt
  Using cached django-toolbelt-0.0.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): django in ./venv/lib/python3.4/site-packages (from django-toolbelt)
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in ./venv/lib/python3.4/site-packages (from django-toolbelt)
Collecting gunicorn (from django-toolbelt)
  Using cached gunicorn-19.3.0-py2.py3-none-any.whl
Collecting dj-database-url (from django-toolbelt)
  Using cached dj_database_url-0.3.0-py2.py3-none-any.whl
Collecting dj-static (from django-toolbelt)
  Using cached dj-static-0.0.6.tar.gz
Collecting static3 (from dj-static->django-toolbelt)
  Using cached static3-0.6.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-w5v7urb2/static3/setup.py", line 52, in <module>
        long_description=open('README.rst').read(),
      File "/home/phi/python/venv/lib/python3.4/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2097: ordinal not in range(128)

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-w5v7urb2/static3

我该如何解决?

1 个答案:

答案 0 :(得分:4)

运行

LC_ALL=en_US.utf8 pip install django-toolbelt

pip存在问题。如果您使用C之类的非unicode语言环境并尝试安装包含pip UnicodeDecodeErrors的程序包,则setup.py尝试读取包含非ASCII字符的文件时可能会抛出。{ / p>

在这种情况下,它是this change中引入的急性口音。

我将在Github上报告此问题。