我尝试通过 pip、setup.py 和使用 wheel 安装 ordered-set,但是这三次我都遇到了异常:
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 包时遇到了同样的问题。
请您参考如下方法:
尝试将 pip 更新到测试版 pip install -U --pre pip
如果没有帮助尝试使用 easy_install
另一种解决方案:
run a new cmd.exe console chcp it will show the system default code, for example 936. open Lib/site-package/pip/compat/init.py around 75 line, change return s.decode('utf_8') to return s.decode('cp936')
这只是 https://github.com/pypa/pip/issues/4251 的解决方法
