欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

UnicodeDecodeError:‘gbk‘codeccan‘tdecodebyte0x80inposition540:illegalmultibyteseque

时间:2023-08-15

错误: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:Anaconda3libsite.py”, line 439, in register_readline
readline.read_history_file(history)
File “F:Anaconda3libsite-packagespyreadlinerlmain.py”, line 165, in read_history_file
self.mode._history.read_history_file(filename)
File “F:Anaconda3libsite-packagespyreadlinelineeditorhistory.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:Anaconda3Libsite-packagespyreadlinelineeditorhistory.py 第82行:
将:for line in open(filename, ‘r’)
改为:for line in open(filename, ‘rb’)
改后保存即可

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。