Windows上使用pip出现UnicodeDecodeError: 'gbk' codec can't decode
windows 10 上python3.6在CMD上使用pip list
时出现如下错误:
Traceback (most recent call last):
File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python36\Scripts\pip.exe\__main__.py", line 9, in <module>
File "c:\program files\python36\lib\site-packages\pip\__init__.py", line 219, in main
cmd_name, cmd_args = parseopts(args)
File "c:\program files\python36\lib\site-packages\pip\__init__.py", line 159, in parseopts
parser = create_main_parser()
File "c:\program files\python36\lib\site-packages\pip\__init__.py", line 137, in create_main_parser
parser = ConfigOptionParser(**parser_kw)
File "c:\program files\python36\lib\site-packages\pip\baseparser.py", line 148, in __init__
self.config.read(self.files)
File "c:\program files\python36\lib\configparser.py", line 697, in read
self._read(fp, filename)
File "c:\program files\python36\lib\configparser.py", line 1015, in _read
for lineno, line in enumerate(fp, start=1):
UnicodeDecodeError: 'gbk' codec can't decode byte 0x90 in position 101: illegal multibyte sequence
pip
命令均会出现这个错误。网上找到大多是python2的,使用sys.setdefaultencoding()
来修改,但在python3中并没有这个,而且把CMD的编码改成65001(utf-8)
还是没用。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
修改
%APPDATA%pippip.ini
编码为ACSI编码.亲试有用。