1.报错内容:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
原因:django2.2和pymysql版本不匹配。mysqldb不支持python3解决方案:
两个错误会同时出现
1、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.
解决办法:
C:Python37Libsite-packagesdjangodbackendsmysql(python安装目录)打开base.py,注释掉以下内容: if version < (1, 3, 13):
raise ImproperlyConfigured(‘mysqlclient 1.3.13 or newer is required; you have %s.’ % Database.version)
2、AttributeError: ‘str’ object has no attribute ‘decode’
File “C:Python37libsite-packagesdjangodbackendsmysqloperations.py”, line 146, in last_executed_query
query = query.decode(errors=‘replace’)
解决办法:
打开此文件把146行的decode修改为encode