django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2

使用python3.7+django2.2+pymysql時遇到這個錯誤:python

django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2

解決方案:
一、raise ImproperlyConfigured(‘mysqlclient 1.3.13 or newer is required; you have %s.’ % Database.version)
  django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.  
解決辦法:
C:\Python37\Lib\site-packages\django\db\backends\mysql(python安裝目錄)打開base.py,註釋掉如下內容:        
if version < (1, 3, 13):           raise ImproperlyConfigured(‘mysqlclient 1.3.13 or newer is required; you have %s.’ % Database.version)   
二、File 「C:\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’   
解決辦法:
打開此文件把146行的decode修改成encodemysql

 

原文連接:https://blog.csdn.net/weixin_45476498/article/details/100098297sql

相關文章
相關標籤/搜索