错误
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
File "C:Users向成功AppDataLocalProgramsPythonPython38libsite.py", line 440, in register_readline
readline.read_history_file(history)
File "C:Users向成功AppDataLocalProgramsPythonPython38libsite-packagespyreadline
lmain.py", line 165, in read_history_file
self.mode._history.read_history_file(filename)
File "C:Users向成功AppDataLocalProgramsPythonPython38libsite-packagespyreadlinelineeditorhistory.py", line 82, in read_history_file
for line in open(filename, 'r'):
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 341: illegal multibyte sequence
解决办法
进入到该目录:C:Users向成功AppDataLocalProgramsPythonPython38Libsite-packagespyreadlinelineeditor ,
history.py文件的第82行,修改如下:
for line in open(filename, 'r',encoding='utf-8'):
在原有的open函数里 新增了一个参数选项encoding='utf-8'
就可以解决了