UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 898: illegal multibyte sequence
程序员文章站
2022-04-26 15:17:42
...
1.问题描述
Windows环境下,打开cmd,然后运行Python命令,这个时候突然发现报错了,错误信息如下:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 898: illegal multibyte sequence
截图:
2.解决方法
找到最后一行代码:
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'):
添加编码后,保存退出即可正常运行!
上一篇: 根据实体生成sql语句
下一篇: 今天教女朋友游泳
推荐阅读
-
Anaconda中启动Python时的错误:UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 553
-
命令行调用python出现编码错误:UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x9a in position 140 完美解决!
-
真正解决Windows下UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xff in position 0错误的方法
-
2021-09‘gbk‘ codec can‘t decode byte 0x80 in position 9: illegal multibyte sequence-29
-
Anaconda中启动Python时的错误:UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 553
-
Python读取中文文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 64
-
解决Win环境下,使用scrapy的gbk编码问题,UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 220
-
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 898: illegal multibyte sequence
-
真正解决Windows下UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xff in position 0错误的方法
-
命令行调用python出现编码错误:UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x9a in position 140 完美解决!