pip install& UnicodeDecodeError:' utf-8'编解码器不能解码位置9中的字节0xe0:无效的连续字节

时间:2018-01-15 19:50:18

标签: python pip

尝试安装:

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

如何解决?

2 个答案:

答案 0 :(得分:2)

... OKAY

  1. 由于错误发生在我的档案中:
      

    C:\用户\анна\应用程序数据\本地\程序\蟒\ python36 \ lib中\站点包\ PIP \ compat__init __吡啶

  2. 问题文件夹是“анна”,这是 cp1251

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

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

      return s.decode(sys.__stdout__.encoding)

    3. 进入

      return s.decode('cp1251')

    4. 当然,你需要知道你有什么编码。在我身上 cp1251 ,在你身上它可以是拉丁(例如)。在文件中替换后 - 一切都安装成功!

      谢谢2 cowbert

答案 1 :(得分:1)

我建议使用快速修复此类情况。通过将输出从标准方向(终端)重定向到如下文件来完成修复:

pip install python-binance > temp_output_file

如果您需要,请打开它......