error:
PS D:\IT2.0\helloworld> python
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [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 "D:\Program\anaconda31903\lib\site.py", line 439, in register_readline
readline.read_history_file(history)
File "D:\Program\anaconda31903\lib\site-packages\pyreadline\rlmain.py", line 165, in read_history_file
self.mode._history.read_history_file(filename)
File "D:\Program\anaconda31903\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 0xae in position 351: illegal multibyte sequence
>>>
Solution:
And I solved the problem so:
Open file C:\Python351\lib\site-packages\pyreadline\lineeditor\history.py.
(In my case, D:\Program\anaconda31903\Lib\site-packages\pyreadline\lineeditor)
Go to 82 line and edit:
this - for line in open(filename, 'r'):
on this - for line in open(filename, 'r', encoding='utf-8'):
OK~