query = query.decode(errors=‘replace‘)

django python manage.py makemigrations进行执行时报一下错误

    cursor.execute('SELECT @@SQL_AUTO_IS_NULL')
  File "C:\Users\allve\Envs\my36\lib\site-packages\django\db\backends\utils.py", line 103, in execute
    sql = self.db.ops.last_executed_query(self.cursor, sql, params)
  File "C:\Users\allve\Envs\my36\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in last_executed_q
uery
    query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'

query = query.decode(errors=‘replace‘)_第1张图片

将decode改为encode

query = query.decode(errors=‘replace‘)_第2张图片

你可能感兴趣的:(python报错)