通过pip install virtualenv安装时出现UnicodeDecodeError

时间:2017-07-14 19:24:32

标签: pip virtualenv setuptools

virtualenv 15.0.1

Ubuntu 16.04.1 LTS

区域设置:

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C

这完美执行(virtualenv已停用):

root@simple_project:~# pip install django-crequest==2016.3.16

但是当我激活virtualenv时:

(photoarchive) root@simple_project:~/venv# pip install django-crequest==2016.3.16
Collecting django-crequest==2016.3.16
  Using cached django-crequest-2016.3.16.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-g5etn1cn/django-crequest/setup.py", line 9, in <module>
        license=open('LICENSE').read(),
      File "/root/venv/photoarchive/lib/python3.6/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 204: ordinal not in range(128)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-g5etn1cn/django-crequest/

你能帮我理解发生了什么以及如何应对这个问题吗?

1 个答案:

答案 0 :(得分:1)

该包似乎在其LICENSE文件中包含非ascii文本,而某些内容(pip?)不喜欢它。尝试设置LC_CTYPE="C.UTF-8"

相关问题