Django2.2连接mysql数据库出现django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None问题
在使用Django2.2开发的时候,想要使用mysql数据库,在settings.py文件中更改命令:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'python',
'USER': "root",
'PASSWORD': "yhr2323214310",
'HOST': '',
'PORT': ''
}
}
再安装好pymysql,然后在__init__.py文件中添加:
import pymysql
pymysql.install_as_MySQLdb()
然后在models中创建好表类后,进行数据迁移时出现问题:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None
上网查一下解决方法,费了好大劲
解决方法:
1.找到base.py文件,我的是在~/PycharmProject/myBlog/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py
就是在你项目文件夹下的/venv/lib/python3.6/site-packages/django/db/backends/mysql/中
进去进行修改:
找到这段代码:version = Database.version_info
修改下面的if语句:添加pass,再注释掉,就像这个样子:
if version < (1, 3, 13):
pass
'''
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
'''
保存后,在进入同路径下的operations.py文件
将query = query.decode(errors='replace')中的decode改为encode
保存
再次进行数据迁移,成功!可以成功连接到mysql。
Django2.2连接mysql数据库出现django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None问题的更多相关文章
- django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11
搭建Django2.0+Python3+MySQL5时同步数据库时报错:django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 o ...
- Django2.2报错 django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
准备将 Django 连接到 MySQL,在命令行输入命令 python manage.py makemigrations 后报错: django.core.exceptions.Improperly ...
- 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 ...
- django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.解决办法
"E:\API_Manager_PlatForm\venv\lib\site-packages\django\db\backends\mysql\base.py"在这个路径里件把b ...
- django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
异常汇总:https://www.cnblogs.com/dotnetcrazy/p/9192089.html 这个是Django对MySQLdb版本的限制,我们使用的是PyMySQL,所以不用管它 ...
- Django生成脚本迁移文件时,报错django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
一.本人环境:django:3.0.2, python:3.8.1, pymysql:0.9.3 二.解决步骤: 1.django目录下找到 base.py文件: 2.在base.py文件中注释以下 ...
- django2.2/mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3
报错环境 python=3.6.5,django=2.2,PyMySQL=0.9.3 …… django.core.exceptions.ImproperlyConfigured: mysqlcl ...
- exceptions: django2.2/ mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3
在centos部署python应用后访问页面,显示如下异常信息 报错环境 python=3.6,django=2.2……django.core.exceptions.ImproperlyConfigu ...
- Django项目配置数据库时,已安装mysqlclient,却提示 Did you install mysqlclient错误,后右报错ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3
错误信息如下: 解决方案是: 找到自己的项目文件夹下的__init__.py 添加如下代码 解决这个问题后,右报错django2.2/mysql ImproperlyConfigured: mysq ...
随机推荐
- python 比较运算符
x == y x < y x <= y x >= y x != y x is y x is not y x in y x not in y >>> "f ...
- [Luogu] 遥远的国度
https://www.luogu.org/problemnew/show/P3979 3种情况 x=root,很显然此时应当查询整棵树 lca(root,x)!=x ,此时直接查询x的子树即可,与换 ...
- 【概率论】3-6:条件分布(Conditional Distributions Part II)
title: [概率论]3-6:条件分布(Conditional Distributions Part II) categories: Mathematic Probability keywords: ...
- masm 编译贪吃蛇游戏
code: ;TITLE GAME4TH PAGE , STSEG SEGMENT DB DUP () STSEG ENDS ;----------------------------------- ...
- 将elasticsearch设置为windows系统服务
目前我都是在windows的环境下操作是Elasticsearch,并且喜欢使用命令行 启动时通过cmd直接在elasticsearch的bin目录下执行elasticsearch 这样直接启动的话集 ...
- 线上bug或故障界定及填写规范
[线上故障与线上Bug界定] 一.线上故障: 1. 故障参照公司规范稍做调整: a) 1级故障:资讯首页或主App首页无法打开:多条业务线同时不可用:超过15分钟: b) ...
- 关于安卓端 点击button时出现橙色边框
一开始我以为是安卓的原因,后来经过测试发现不是,出现这个情况应该button的outline属性生效了,但是我已经写了outline 为none,后来发现,需要写上:foucs{ outline:0 ...
- 感知机与BP神经网络的简单应用
感知机与神经元 感知机(Perceptron)由两层神经元组成(输入层.输出层),输入层接收外界输入信号后传递给输出层,输出层是M-P神经元,亦称“阈值逻辑单元”(threshold logic un ...
- 【SVN】彻底 svn 服务器上的 删除某一个文件或文件夹
参考: CSDN1:https://blog.csdn.net/u011729865/article/details/78764523 CSDN2:https://blog.csdn.net/wyyo ...
- Java-基于 Instrument 的 Agent
Agent 为 JVMTI 的客户端. 这里记录的是基于Java Instrument 的 Agent 实现,还有直接基于 JVMTI 的 Agent 实现. 在 JDK1.5 以后,我们可以使用 A ...