当前位置:Gxlcms > 数据库问题 > Django踩坑之django.core.exceptions.ImproperlyConfigured mysqlclient 1.3.13 or newer is required; you have 0.9.3.

Django踩坑之django.core.exceptions.ImproperlyConfigured mysqlclient 1.3.13 or newer is required; you have 0.9.3.

时间:2021-07-01 10:21:17 帮助过:20人阅读

安装Django3后不想折腾mysqlclient那堆库文件,直接装了pymysql替代mysqlclient,报错:django.core.exceptions.ImproperlyConfigured mysqlclient 1.3.13 or newer is required; you have 0.9.3.。实际上pymysql版本号是 0.9.3,却明目张胆篡改version_info欺骗Django??。这样一来就简单了,patch一下这个属性就行了嘛, 修改__init__.py,多插入一行代码:

import pymysql
pymysql.version_info = (1, 3, 13, "final", 0)
pymysql.install_as_MySQLdb()

参考博客:https://yuntianti.com/posts/fix-django3-mysqlclient-import-error/

Django踩坑之django.core.exceptions.ImproperlyConfigured mysqlclient 1.3.13 or newer is required; you have 0.9.3.

标签:sts   required   插入   安装   代码   configure   版本   tps   ons   

人气教程排行