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

发布于 2022-09-06 01:19:00 字数 4421 浏览 20 评论 0

用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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北音执念 2022-09-13 01:19:00

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

py -3 -m pip install Pillow
绝情姑娘 2022-09-13 01:19:00

路径有中文,朱大老板

pip install Pillow

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文