本文介绍了点安装UnicodeDecodeError:'utf-8'编解码器无法解码位置9的字节0xe0:无效的继续字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试安装:

pip install python-binance

结果:

Exception:
Traceback (most recent call last):
  File "c:\users\анна\appdata\local\programs\python\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 0xe0 in position 9: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\анна\appdata\local\programs\python\python36\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\users\анна\appdata\local\programs\python\python36\lib\site-packages\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "c:\users\анна\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\users\анна\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "c:\users\анна\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "c:\users\анна\appdata\local\programs\python\python36\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\users\анна\appdata\local\programs\python\python36\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\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 0xe0 in position 9: invalid continuation byte

如何解决?

推荐答案

确定...

  1. 由于错误出在我的文件中:
  1. Since the error was in my file:

问题文件夹为"анна",其为 cp1251

The problem folder was 'анна' which was is cp1251

  1. 第一个解决方案是找到如何重命名用户的文件夹. (除了重新安装操作系统外).到带有拉丁字母的文件夹

  1. The first solution is to find how to rename the user's folder. (except for reinstalling the operating system). To the folder with the Latin alphabet

文件 compat__init __.py 中的第二个路径-替换

The second path in the file compat__init__.py - replace

return s.decode(sys.__stdout__.encoding)

进入

return s.decode('cp1251')

当然,您需要知道您使用的编码.对我来说,它是 cp1251 ,对您来说,它可以是 latin (例如).替换文件后-一切都安装成功!

Of course you need to know what encoding you have. At me it cp1251, at you it can be latin (for an example). After the replacement in the file - everything was installed successfully!

感谢2考伯特

这篇关于点安装UnicodeDecodeError:'utf-8'编解码器无法解码位置9的字节0xe0:无效的继续字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:47