最近在使用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'解决办法相关推荐

  1. python3 报错 TypeError: load() got an unexpected keyword argument ‘encoding‘ 解决方法

    目录 错误现象 错误原因 解决方法 错误现象 错误原因 python3中不需要encoding,python2和python3的差别 解决方法 在python3中把 encoding删掉

  2. json.loads时TypeError: __init__() got an unexpected keyword argument ‘encoding‘ 的解决方案

      大家好,我是爱编程的喵喵.双985硕士毕业,现担任全栈工程师一职,热衷于将数据思维应用到工作与生活中.从事机器学习以及相关的前后端开发工作.曾在阿里云.科大讯飞.CCF等比赛获得多次Top名次.现 ...

  3. 使用scrapy报错:attrs() got an unexpected keyword argument 'eq'解决办法

    使用scrapy的时候报错attrs() got an unexpected keyword argument 'eq',在百度和bing上面找了一圈没找到解决方法,最后在谷歌上找到了,出现这个问题的 ...

  4. pip错误:TypeError: parse() got an unexpected keyword argument 'transport_encoding'

    Win10,ANACONDA3(64-bit),Python3.6.2.ANACONDA Prompt中不能用pip命令安装包,并且是在安装了TensorFlow后才发生的.报错如下: Excepti ...

  5. 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. ...

  6. 已解决TypeError: __init__() got an unexpected keyword argument ‘n_iterations‘

    已解决TypeError: init() got an unexpected keyword argument 'n_iterations' 文章目录 报错问题 解决方法 PS 报错问题 之前在工作中 ...

  7. 成功解决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() ...

  8. 成功解决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 ...

  9. 成功解决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' 目录 解决问题 ...

最新文章

  1. MSN 无法登录 错误代码 8007007e
  2. ansible-playbook之条件判断
  3. Vue.js 由 1 到 2 的旅程 - (1)
  4. SpringCloud教程-服务的注册与发现Eureka(SpringCloud版本Finchley)
  5. 注意1:图像插值理论的理解
  6. 设置材质阿尔法通道和双面渲染
  7. 企业实战(Jenkins+GitLab+SonarQube)_01_Jenkins下载
  8. js ul 清缓存_JavaScript使用ul中li标签实现删除效果
  9. linux培训课程第一天:ppt以及笔记
  10. DXperience中文视频教程(上)
  11. 获取请求真实IP地址的工具类
  12. 计算机键盘重复设置,电脑键盘错乱怎么恢复 一键快速重新设置电脑快捷键方法...
  13. Python中的爬虫
  14. 快速抢占Shopee墨西哥广告蓝海,Shopee广告投放策略分享
  15. 使用流报错:stream has already been operated upon or closed
  16. 前端生成pdf的js库-pdfmake.js的简单使用
  17. dz手机版空白显示index.php,discuz x3.3安装插件时页面出现空白有两种解决方法
  18. 什么时候可以找回民族的自尊,不再崇洋媚外?--从华晨老总骏捷发布会的一番话说起...
  19. 如何c语言解析html中的图片地址,【c语言】使用gumbo解析HTML
  20. 壁纸 | iOS 14 内置这几张壁纸,你喜欢吗?

热门文章

  1. 月薪没过20K的程序员要注意了!(文末送书)
  2. kafka中生产者是如何把消息投递到哪个分区的?消费者又是怎么选择分区的?...
  3. 每日一皮:单身狗的悲哀...
  4. 面试归来,我有一个重要发现……
  5. Redis 性能问题分析
  6. pip is configured with locations that require TLS/SSL 解决
  7. 追求极致:Repvgg重参数化对YOLO工业落地的实验和思考
  8. ubuntu nano用法
  9. python 爬虫工具
  10. NetworkOnMainThreadException异常