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

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


参考文献1:https://blog.csdn.net/weixin_45476498/article/details/100098297
参考文献2:https://blog.csdn.net/qq_35304570/article/details/79674449
参考文献3:https://www.cnblogs.com/ljd4you/p/8592765.html

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_45476498/article/details/100098297

使用python3.6.9+django2.2.5+pymysql时遇到这个错误

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

 
 
  • 1

别急,这主要是django2.2内部的一个版本限制在作怪

处理方案

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:\Python37\Lib\site-packages\django\db\backends\mysql(python安装目录)打开base.py,注释掉以下内容:        
if version < (1, 3, 13):           raise ImproperlyConfigured(‘mysqlclient 1.3.13 or newer is required; you have %s.’ % Database.version)   
2、File “C:\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’   
解决办法:
打开此文件把146行的decode修改为encode

找到安装python的这个位置
在这里插入图片描述

改成如图
在这里插入图片描述在这里插入图片描述ps.django2.2不支持pyMySQL,但2.2是LTS,有想过试试mysqldb,但是MySQLDB又不支持python3。。。。的确让人头大。

附:django2.2教程中文版

                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-095d4a0b23.css" rel="stylesheet">
                </div>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值