django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2的最佳处理方法,亲测可用
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.2的最佳处理方法,亲测可用
报错django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
原因:django2.2和pymysql版本不匹配。mysqldb不支持python3.
解决步骤:
1.进入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.进入Python37\lib\site-packages\django\db\backends\mysql(Python安装目录) 打开operations.py,定位到146行
把decode修改为encode
3.打开当前项目名下的__init__文件,在文件中输入如下代码:pymysql.version_info=(1,3,13,"final",0)
import pymysql
pymysql.version_info=(1,3,13,"final",0)
pymysql.install_as_MySQLdb()
执行以上三个步骤后,亲测可以解决该问题