問題描述
Django項目啟動,當我們執行命令 python manage.py makemigrations 出現如下錯誤:
File "/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/operations.py", line 147, in last_executed_query query = query.decode(errors='replace') AttributeError: 'str' object has no attribute 'decode'
解決辦法
順着報錯信息,找到報錯的位置,把
query = query.decode(errors='replace') 修改成 query = query.encode(errors='replace')
