(数据迁移老问题)django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2

I、将你的Django降低到2.14以下即可:这个不用想,就要用最新的

II、升级的mysql客户端版本至更高:电脑同时运行的还有php等其他语言,懒得折腾

III、按照以下步骤修改代码:

 

修复源码
按照文中配置,报错django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
原因:django2.2和pymysql版本不匹配。mysqldb不支持python3.

 

# 解决办法:(约35-37行)
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修改为encode

 

posted @ 2020-08-08 18:16  凌醉枫  阅读(158)  评论(0编辑  收藏  举报