PyQt QSqlDatabase:未加载 QMYSQL 驱动程序 [英] PyQt QSqlDatabase: QMYSQL driver not loaded

查看:89
本文介绍了PyQt QSqlDatabase:未加载 QMYSQL 驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 64 位 Windows 的 Python 3.6 上使用 PyQt5 连接到 MySQL 数据库.当我调用 QSqlDatabase.addDatabase('MYSQL') 并运行我的实用程序时,它显示以下错误消息:

I am trying to connect to a MySQL database using PyQt5 on Python 3.6 for 64-bit Windows. When I call QSqlDatabase.addDatabase('MYSQL') and run my utility, it shows up with this error message:

QSqlDatabase:未加载 QMYSQL 驱动程序QSqlDatabase:可用驱动程序:QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

这让我很困惑,因为根据错误消息,QMYSQL 驱动程序已加载.我通过默认安装程序安装了 PyQt,所以应该安装 MySQL 插件.有没有其他人遇到过这个问题,或者有人知道这个问题的原因吗?

This confuses me since according to the error message, the QMYSQL driver is loaded. I installed PyQt through the default installer, so the MySQL plugin should be installed. Has anyone else experienced this problem or does someone know the cause of this?

推荐答案

说驱动可用,但是需要基于Qt源代码和Mysql库重新构建一个新的Mysql驱动.

It said driver available but you need to rebuid a new Mysql driver base on Qt Source code and Mysql Library.

这篇关于PyQt QSqlDatabase:未加载 QMYSQL 驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆