执行:<python manage.py makemigrations>时,出现:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is requ
ired; you have 0.9.3.
如下图:
解决方法:
进入终端中提示的路径:
(C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-p
ackages\django\db\backends\mysql\base.py),用文本打开,找到(
version = Database.version_info
if version < (1, 3, 13):
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
)并将以下两行注释掉,如下:
若报以下故障代码:
query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'
如下:
修复方法:
进入此路径下:
C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-p
ackages\django\db\backends\mysql\operations.py
如下:
,以文本格式打开,将decode改为encode
如下:
---问题解决。