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


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

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

解決方案:
1、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)   
2、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修改為encode

 

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM