pip安装第三方库时出现错误,提示编码无法识别

用pip安装pillow时出现错误,代码如下:

操作系统win10-64,使用python3.6.3,用windows power shell安装

PS C:\WINDOWS\system32> pip install pillow Collecting pillow   Using cached Pillow-4.3.0-cp36-cp36m-win_amd64.whl Collecting olefile (from pillow)   Using cached olefile-0.44.zip Installing collected packages: olefile, pillow   Running setup.py install for olefile ... error Exception: Traceback (most recent call last):   File "c:\program files\python36\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 0xd6 in position 45: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)   File "c:\program files\python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,   File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs   File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,   File "c:\program files\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())   File "c:\program files\python36\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 0xd6 in position 45: invalid continuation byte

已经尝试过github上的方法:pip install git+https://github.com/sshwsfc/xa...但是安装时仍然报错,错误代码如下:

PS C:\WINDOWS\system32> pip install git+https://github.com/sshwsfc/xadmin
Collecting git+https://github.com/sshwsfc/xadmin
  Cloning https://github.com/sshwsfc/xadmin to c:\users\朱大老板\appdata\local\temp\pip-52hzxgm4-build
Requirement already satisfied: setuptools in c:\program files\python36\lib\site-packages (from xadmin==0.6.1)
Requirement already satisfied: django<2,>=1.9.0 in c:\program files\python36\lib\site-packages (from xadmin==0.6.1)
Requirement already satisfied: django-crispy-forms>=1.6.0 in c:\program files\python36\lib\site-packages (from xadmin==0.6.1)
Requirement already satisfied: django-reversion>=2.0.0 in c:\program files\python36\lib\site-packages (from xadmin==0.6.1)
Collecting django-formtools>=1.0 (from xadmin==0.6.1)
  Using cached django_formtools-2.1-py2.py3-none-any.whl
Collecting httplib2==0.9.2 (from xadmin==0.6.1)
  Using cached httplib2-0.9.2.zip
Collecting future (from xadmin==0.6.1)
  Using cached future-0.16.0.tar.gz
Collecting six (from xadmin==0.6.1)
  Using cached six-1.11.0-py2.py3-none-any.whl
Requirement already satisfied: pytz in c:\program files\python36\lib\site-packages (from django<2,>=1.9.0->xadmin==0.6.1)
Installing collected packages: django-formtools, httplib2, future, six, xadmin
  Running setup.py install for httplib2 ... error
Exception:
Traceback (most recent call last):
  File "c:\program files\python36\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 0xd6 in position 45: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\program files\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\program files\python36\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\program files\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\program files\python36\lib\site-packages\pip\req\req_install.py", line 878, in install
    spinner=spinner,
  File "c:\program files\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "c:\program files\python36\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 0xd6 in position 45: invalid continuation byte
阅读 12.5k
2 个回答

我之前也遇见了这个问题,通过以下的方式解决了,你试试看:

py -3 -m pip install Pillow

路径有中文,朱大老板

pip install Pillow

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题