django2.x -- bug:query = query.decode(errors=‘replace‘) AttributeError: ‘str‘ object has no attribute ‘decode‘
运行项目时报错“query = query.decode(errors=‘replace‘) AttributeError: ‘str‘ object has no attribute ‘decode‘”(虚拟环境下)
解决方法:
- 在报错内容中进入“~/.virtualenvs/your_env_name/lib/python3.8/site-packages/django/db/backends/mysql/operations.py”文件
- 修改query = query.decode(errors='replace')为 query = errors='replace'