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

原文链接: https://blog.csdn.net/qq_35304570/article/details/79674449

搭建Django2.0+Python3.6+MySQL5.6时同步数据库时报错:

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

解决办法:

找到Python安装路劲下的Python36-32\Lib\site-packages\django\db\backends\mysql\base.py文件

将文件中的如下代码注释

if version < (1, 3, 3):
    raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)

重新在项目manage.py路劲下执行如下命令即可

python manage.py makemigrations
python manage.py migrate

如果把上面的代码注释了还出现以下问题

错误代码:query = query.encode(errors=‘replace’)
解决方法:把decode改为encode即可。
改源码不放心的话可以注释备份一下
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3_第1张图片

你可能感兴趣的:(mysql)