找到Python环境下 django包,并进入到backends下的mysql文件夹
找到base.py文件,注释掉 base.py 中如下部分(35/36行)
if version < (1, 3, 3):
raise ImproperlyConfigured(“mysqlclient 1.3.3 or newer is required; you have %s” % Database.version)
AttributeError: ‘str’ object has no attribute ‘decode’
if query is not None:
query = query.decode(errors=‘replace’)
return query
#改为
if query is not None:
query = query.encode(errors=‘replace’)
return query