尝试安装有序集时出现UnicodeDecodeError

时间:2018-08-07 09:47:58

标签: python python-3.x

我尝试通过pip,setup.py和使用wheel安装有序集,但所有这三遍我都遇到了例外:

Exception:
Traceback (most recent call last):
  File "c:\python 3.6.3\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 0xcd in position 35: 
invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "c:\python 3.6.3\lib\site-packages\pip\basecommand.py", line 215, in main 
status = self.run(options, args)
 File "c:\python 3.6.3\lib\site-packages\pip\commands\install.py", line 335, in run wb.build(autobuilding=True)
 File "c:\python 3.6.3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
 File "c:\python 3.6.3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
 File "c:\python 3.6.3\lib\site-packages\pip\req\req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
 File "c:\python 3.6.3\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
 File "c:\python 3.6.3\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
command_desc='python setup.py egg_info')
 File "c:\python 3.6.3\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "c:\python 3.6.3\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 0xcd in position 35: 
invalid continuation byte

这可能取决于什么?我该怎么解决这个问题?

在安装stix和cybox软件包期间,我遇到了同样的问题。

1 个答案:

答案 0 :(得分:1)

尝试将点更新为测试版pip install -U --pre pip

如果这样做没有帮助,请尝试使用easy_install

另一种解决方案:

  

运行一个新的cmd.exe控制台chcp,它将显示系统默认代码,   例如936。打开Lib / site-package / pip / compat / init .py   75行,将return s.decode('utf_8')更改为返回s.decode('cp936')

这只是https://github.com/pypa/pip/issues/4251

中的解决方法