1、最近在使用django,报了一个错误:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6
根据提示找到 python安装路径\Lib\site-packages\django\views\debug.py ,打开后,修改约在 332 行处,将:
with Path(CURRENT_DIR, 'templates', 'technical_500.html').open() as fh:
修改为
with Path(CURRENT_DIR, 'templates', 'technical_500.html').open(encoding='utf-8') as fh:
就可以了。