pip安装枕头' utf-8'编解码器无法解码

时间:2017-07-11 08:56:47

标签: python utf-8 pip install pillow

我使用pip和pip3和easy_install安装枕头我收到了一个错误:

$ Exception:
Traceback (most recent call last):
  File "c:\users\梁生珺\appdata\local\programs\python\python36-32\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc1 in position 55: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\梁生珺\appdata\local\programs\python\python36-32\lib\site-        packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\梁生珺\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\users\梁生珺\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\users\梁生珺\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_install.py", line 878, in install
spinner=spinner,
  File "c:\users\梁生珺\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "c:\users\梁生珺\appdata\local\programs\python\python36-32\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc1 in position 55: invalid start byte

我已经使用easy_install来更新pip和pip3。

我使用pip install xxx.whl和pip install pillow。

但它毫无用处。我不知道如何解决这个问题。非常感谢。

1 个答案:

答案 0 :(得分:1)

多个版本的pip存在类似问题。可悲的是,没有适当的解决办法,大多数只是暂时的黑客攻击。

您可以尝试通过downloading the source code并运行python setup.py手动安装Pillow。

您还可以查看this github thread,建议将第75行中的return s.decode('utf-8')替换为return s.decode('cp936'),这是简体中文的字符编码。

进一步阅读

upgrading pip error UnicodeDecodeError: 'utf-8' codec can't decode byte

pip UnicodeDecodeError: 'utf8' codec can't decode byte