标签:arm errors operation pychar ISE you 解决 代码注释 支持
python manage.py makemigrations
or
python manage.py inspectdb
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None
使用注释大法解决:找到自己Python安装路劲下的Python36-32\Lib\site-packages\django\db\backends\mysql\base.py文件 将文件中的如下代码注释(可能需先关闭pycharm IDE)
if version < (1, 3, 3):
raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)
py3默认str是unicode编码,通过encode方法编码成bytes类型,后者才有decode解码方法。提示错误来源:Python36\lib\site-packages\django\db\backends\mysql\operations.py", line 149, in last_executed_query
解决办法:
1. 再报错的Python36\lib\site-packages\django\db\backends\mysql\operations.py文件最上面添加
from django.utils.encoding import force_str
2. 将last_executed_query方法中如下代码注释
query = getattr(cursor, '_executed', None)
if query is not None:
query = query.decode(errors='replace')
return query
3. 在注释的代码下添加如下代码:
return force_str(getattr(cursor, '_executed', None), errors='replace')
然后再次执行python manage.py makemigrations 成功
参考连接: https://www.zhangshengrong.com/p/281om6qgNw/
标签:arm errors operation pychar ISE you 解决 代码注释 支持
原文地址:https://www.cnblogs.com/heaven-xi/p/11422355.html