flask_sqlalchemy连接Mysql报TypeError: create_engine() got an unexpected keyword argument 'encoding'解决办法
最近在使用flask_sqlalchemy连接mysql,但是遇到一个很奇葩的问题,代码如下:
#-*-coding:utf-8 -*-from flask_sqlalchemy import SQLAlchemydb = SQLAlchemy()
db.create_engine("mysql+://root:root@xxx.xxx.xxx.5:3306/auto_test", encoding='utf-8', echo=True)
相关的依赖库版本如下:
运行一直报错:TypeError: create_engine() got an unexpected keyword argument 'encoding'。
网上查了很多资料,试了很多办法:
1.将Windows x86-64 MSI installer替换为Windows x86 MSI installer
2.卸载系统上的python3版本
3.更改mysql的连接驱动,如下:
db.create_engine("mysql://root:root@xxx.xxx.xxx.xxx:3306/auto_test", encoding='utf-8', echo=True)db.create_engine("mysql+mysqlconnector://root:root@xxx.xxx.xxx.xxx:3306/auto_test", encoding='utf-8', echo=True)db.create_engine("mysql+pymysql://root:root@xxx.xxx.xxx.xxx:3306/auto_test", encoding='utf-8', echo=True)
以上办法试了都没有解决问题,后来让同事帮忙看看,在他机器上运行却没有报错,后来分析是相关依赖库版本不匹配,
最终,按照他下载的版本安装后解决了问题。
最后的依赖库安装版本如下:
flask_sqlalchemy连接Mysql报TypeError: create_engine() got an unexpected keyword argument 'encoding'解决办法相关推荐
- python3 报错 TypeError: load() got an unexpected keyword argument ‘encoding‘ 解决方法
目录 错误现象 错误原因 解决方法 错误现象 错误原因 python3中不需要encoding,python2和python3的差别 解决方法 在python3中把 encoding删掉
- json.loads时TypeError: __init__() got an unexpected keyword argument ‘encoding‘ 的解决方案
大家好,我是爱编程的喵喵.双985硕士毕业,现担任全栈工程师一职,热衷于将数据思维应用到工作与生活中.从事机器学习以及相关的前后端开发工作.曾在阿里云.科大讯飞.CCF等比赛获得多次Top名次.现 ...
- 使用scrapy报错:attrs() got an unexpected keyword argument 'eq'解决办法
使用scrapy的时候报错attrs() got an unexpected keyword argument 'eq',在百度和bing上面找了一圈没找到解决方法,最后在谷歌上找到了,出现这个问题的 ...
- pip错误:TypeError: parse() got an unexpected keyword argument 'transport_encoding'
Win10,ANACONDA3(64-bit),Python3.6.2.ANACONDA Prompt中不能用pip命令安装包,并且是在安装了TensorFlow后才发生的.报错如下: Excepti ...
- import mayavi.mlab as mlab TypeError: __call__() got an unexpected keyword argument 'qualname'
python3导入mayavi出现错误 TypeError: __call__() got an unexpected keyword argument 'qualname' mayavi==4.7. ...
- 已解决TypeError: __init__() got an unexpected keyword argument ‘n_iterations‘
已解决TypeError: init() got an unexpected keyword argument 'n_iterations' 文章目录 报错问题 解决方法 PS 报错问题 之前在工作中 ...
- 成功解决TypeError: read_excel() got an unexpected keyword argument ‘parse_cols or ‘sheetname‘
成功解决TypeError: read_excel() got an unexpected keyword argument 'parse_cols' TypeError: read_excel() ...
- 成功解决return tf.nn.softmax(x, axis=axis) TypeError: softmax() got an unexpected keyword argument 'axis
成功解决return tf.nn.softmax(x, axis=axis) TypeError: softmax() got an unexpected keyword argument 'axis ...
- 成功解决python\ops\seq2seq.py TypeError: ms_error() got an unexpected keyword argument 'logits'
成功解决python\ops\seq2seq.py TypeError: ms_error() got an unexpected keyword argument 'logits' 目录 解决问题 ...
最新文章
- MSN 无法登录 错误代码 8007007e
- ansible-playbook之条件判断
- Vue.js 由 1 到 2 的旅程 - (1)
- SpringCloud教程-服务的注册与发现Eureka(SpringCloud版本Finchley)
- 注意1:图像插值理论的理解
- 设置材质阿尔法通道和双面渲染
- 企业实战(Jenkins+GitLab+SonarQube)_01_Jenkins下载
- js ul 清缓存_JavaScript使用ul中li标签实现删除效果
- linux培训课程第一天:ppt以及笔记
- DXperience中文视频教程(上)
- 获取请求真实IP地址的工具类
- 计算机键盘重复设置,电脑键盘错乱怎么恢复 一键快速重新设置电脑快捷键方法...
- Python中的爬虫
- 快速抢占Shopee墨西哥广告蓝海,Shopee广告投放策略分享
- 使用流报错:stream has already been operated upon or closed
- 前端生成pdf的js库-pdfmake.js的简单使用
- dz手机版空白显示index.php,discuz x3.3安装插件时页面出现空白有两种解决方法
- 什么时候可以找回民族的自尊,不再崇洋媚外?--从华晨老总骏捷发布会的一番话说起...
- 如何c语言解析html中的图片地址,【c语言】使用gumbo解析HTML
- 壁纸 | iOS 14 内置这几张壁纸,你喜欢吗?