Django+MySQL+python报错:AttributeError: ‘str’ object has no attribute ‘decode’
使用django框架,修改settings.py文件的DATABASES时
报错:AttributeError: ‘str’ object has no attribute ‘decode’
根据最后一行
File "D:\Python 3.7.0\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in last_executed_query
query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'
修改operations.py文件
把decode改为encode
重新运行python manage.py migrate
成功!