简体   繁体   中英

pip install pillow 'utf-8' codec can't decode

I use pip and pip3 and easy_install install pillow i got an error:

$ 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

I am already used easy_install to update pip and pip3.

And I use pip install xxx.whl and pip install pillow.

But it useless. I don't know how to solve this problem. thanks much.

There have been several similar problems with pip on multiple versions. Sadly there is no proper fix, most of them are just temporary hacks.

You can attempt to install Pillow manually, by downloading the source code and running python setup.py .

You can also check out this github thread which suggests replacing return s.decode('utf-8') in line 75 to return s.decode('cp936') which is the character encoding for simplified Chinese.

Further Reading

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM