赞
踩
Windows环境下,打开cmd,然后运行Python命令,这个时候突然发现报错了,错误信息如下:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 898: illegal multibyte sequence
截图:
找到最后一行代码:
File "D:\ProgramData\Anaconda3\lib\site-packages\pyreadline\lineeditor\history.py", line 82, in read_history_file
从该路径下(D:\ProgramData\Anaconda3\lib\site-packages\pyreadline\lineeditor\history.py)找到history.py文件,找到第82行,将该行代码改为:
for line in open(filename, 'r',encoding='utf-8'):
添加编码后,保存退出即可正常运行!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。