mysqlclient 1.3.13 or newer is required

Django開發,由sqlite3切換爲mysql
已經假裝過了, 遷移時,報錯:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.mysql

解決辦法:sql

  1. 將Django下降到2.14如下便可。(沒試過)
    II、升級mysql客戶端版本至更高。(沒試過)
    III、按照如下步驟修改代碼。 (親測有效)
    mysqlclient 1.3.13 or newer is required

按圖找到你Django目錄下的base.py文件
註釋掉下面2句:數據庫

if version < (1, 3, 13):
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.version)django

而後再進行數據庫遷移操做。ide

若是還有問題,好比出現瞭如下問題:
File "D:\Program Files\Python37\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'ui

那就打開上圖中的operations.py文件,146行中的decode改成encode便可。3d

而後再次遷移,成功!code

相關文章
相關標籤/搜索