Introduction
When I was working on a django project, I encountered an error report like the title. Through search and analysis, it was a problem of encode/decode. My decode/encode did not appear in the code I wrote, but in D:\python\Lib\site-packages\django \db\backends\mysql\operations.py, which is the file displayed by the error.
Solution
1. Click to D:\python\Lib\site-packages\django\db\backends\mysql\operations.py in the operations.py where the error is reported 2.
Find the following code
3. There will be a prompt when query = query.decode(errors='replace')
changing to query = query.encode(errors='replace')
change, select The first to continue to change
Solve the error!