Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 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:\anaconda\lib\site.py", line 440, in register_readline
readline.read_history_file(history)
File "F:\anaconda\lib\site-packages\pyreadline\rlmain.py", line 165, in read_history_file
self.mode._history.read_history_file(filename)
File "F:\anaconda\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 0x9a in position 287: illegal multibyte sequence
anaconda 环境启动报错 UnicodeDecodeError: 'gbk' codec can't decode byte 0x9a in position 287: illegal mult
报错文件:
F:\anaconda\Lib\site-packages\pyreadline\lineeditor\history.py
报错提示:第82行 for line in open(filename, 'r'):
- for line in open(filename, 'r'):
+ for line in open(filename, 'r', encoding='utf-8'):
增加:encoding='utf-8'