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‘”(虚拟环境下)

解决方法:

  1. 在报错内容中进入“~/.virtualenvs/your_env_name/lib/python3.8/site-packages/django/db/backends/mysql/operations.py”文件
  2. 修改query = query.decode(errors='replace')为 query = errors='replace'
posted @ 2022-08-26 10:08  我叫好名字  阅读(103)  评论(0编辑  收藏  举报