Django2.2报错:UnicodeDecodeError:'gbk'codeccan'tdecodebyte0xa6inposition9737:illegalmultibytesequence1.问题重现File"D:\Python\Python37-32\lib\site-packages\django\views\debug.py",第332行,在get_traceback_htmlt=DEBUG_ENGINE.from_string(fh.read())UnicodeDecodeError:'gbk'codeccan'tdecodebyte0xa6inposition9737:illegalmultibytesequence2.解决办法打开django/views下的debug.py文件,到第331行:withPath(CURRENT_DIR,'templates','technical_500.html').open()asfh改成:withPath(CURRENT_DIR,'templates','technical_500.html').open(encoding="utf-8")asline338offhmayalsoneedtomodifyencoding.这成功解决了它。
