1、Python3.7+Django2.2操作Mysql数据库时出现如下错误:
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None

是因为MySQLclient目前只支持到python3.4,因此如果使用的更高版本的python,可以修改下面路径的文件:

C:\Users\admin\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\django\db\backends\mysql\base.py
这个路径可能是你报错信息的最后一条路径信息。
将if version < (1, 3, 3):
raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)
注释掉就可以了。
2、python创建更改文件时出现AttributeError: 'str' object has no attribute 'decode'错误

根据问题提示,意思是,属性错误:“str”对象没有属性“decode”
python3.5和Python2.7在套接字返回值解码上的区别 
python在bytes和str两种类型转换,所需要的函数依次是encode(),decode()
我得修改方法是打开报错信息最后一条路径将decode改为encode,再次运行成功生成修改文件,问题解决。
posted on 2019-04-09 10:50  虎虎虎  阅读(570)  评论(0编辑  收藏  举报