user_image
By  时光贝影    On   2019年12月18日 12:48

刘老师,python 3.7.5和Django 2.2中, 我遇到一个问题:settings.py增加了如下: import pymysql # 一定要添加这两行!通过pip install pymysql! pymysql.install_as_MySQLdb() 然后执行python manage.py shell 后报错: File "D:\Python\Python37\lib\site-packages\django\db\backends\mysql\base.py", line 36, in <module> 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. 注释了下列两行: #if version < (1, 3, 13): # raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__) 查了原因是:django2.2不支持pyMySQL,但2.2是LTS,但是MySQLDB又不支持python3