其他分享
首页 > 其他分享> > UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in position 540: illegal multibyte sequence

UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in position 540: illegal multibyte sequence

作者:互联网

错误:Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type “help”, “copyright”, “credits” or “license” for more information.
Failed calling sys.interactivehook
Traceback (most recent call last):
File “F:\Anaconda3\lib\site.py”, line 439, in register_readline
readline.read_history_file(history)
File “F:\Anaconda3\lib\site-packages\pyreadline\rlmain.py”, line 165, in read_history_file
self.mode._history.read_history_file(filename)
File “F:\Anaconda3\lib\site-packages\pyreadline\lineeditor\history.py”, line 82, in read_history_file
for line in open(filename, ‘r’):
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xaf in position 173: illegal multibyte sequence
解决方法:D:\Anaconda3\Lib\site-packages\pyreadline\lineeditor\history.py 第82行:
将:for line in open(filename, ‘r’)
改为:for line in open(filename, ‘rb’)
改后保存即可

标签:Anaconda3,sequence,illegal,py,multibyte,site,file,line,history
来源: https://blog.csdn.net/weixin_45755709/article/details/122765485