python3.x運行的坑:AttributeError: 'str' object has no attribute 'decode'
2019.05.22 21:38:45字數124閱讀1909
1、Python3.x和Python2.X版本有一些區別,我遇到了兩個問題如下:
a.第一個報:mysqlclient 1.3版本不對:
解決辦法:注釋掉這行即可;
b.第二個報:字符集的問題:
報錯如下:File "C:\Users\Administrator\PycharmProjects\untitled1\venv\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'
報錯截圖:

解決辦法:注釋掉這里,因為字符集不支持的原因
