您的位置:首页 > 产品设计 > UI/UE

django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3

2020-02-02 23:46 826 查看

代码运行环境说明:

Python:3.7.4
Django:2.2.6
PyMySQL:0.9.3

执行数据库迁移时输入命令:python manage.py makemigrations出现以下提示:

django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

网上查资料发现解决方法有三种:

  1. 将你的Django降低到2.14以下;
  2. 升级的mysql客户端版本至更高 ;
  3. 按照以下步骤修改代码:

    将base.py中

    修改为:

继续输入命令:python manage.py migrate如果出现以下情况:

File "D:\Program Files\Python37\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in last_executed_query
query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'

将operations.py中的

修改为:

继续执行命令:python manage.py migrate如果出现以下情况:

django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ver
sion for the right syntax to use near '(6) NOT NULL)' at line 1"))

这个是因为Django2.1不再支持MySQL5.5,必须5.6版本以上

解决办法:将MySQL升级

  • 点赞
  • 收藏
  • 分享
  • 文章举报
若与你相遇 发布了3 篇原创文章 · 获赞 0 · 访问量 80 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐