python - “ImportError:导入 mariadb 时 DLL 加载失败:找不到指定的模块”的解决方法。
问题描述
在使用 Python 3.8.3 在 Windows 64 位上安装 MariaDB Connector/Python 后,我收到以下错误import mariadb
:
ImportError: DLL load failed while importing mariadb: The specified module could not be found.
显然这是一个已知问题。请您帮我找到解决方法,直到问题得到解决?
清单venv\app_name\Lib\site-packages\mariadb-0.9.58.dist-info
产生以下结果:
2020-05-25 16:41 4 INSTALLER
2020-05-25 16:41 27,030 LICENSE
2020-05-25 16:41 2,625 METADATA
2020-05-25 16:41 572 RECORD
2020-05-25 16:41 8 top_level.txt
2020-05-25 16:41 105 WHEEL
6 File(s) 30,344 bytes
显然它看起来不像很多有用的东西,因为没有 Python 或 C/C++ 模块。所以也许安装pip3 install --pre mariadb
失败了(尽管它报告成功)。
我想到了以下候选解决方案:
- 使用 MySQL 连接器/Python 连接到 MariaDB。这是一个可行的解决方案吗?
- 从源代码构建 MariaDB 连接器/Python 或以其他方式下载预构建的包(如果可用)。但是如何做到这一点?
解决方案
显然,最快、最可靠的解决方案(据我所知)是按照 wiki 中的步骤从源代码构建 MariaDB Connector/Python ,特别是安装了 MSVS 2019 和 MariaDB Connector/C,我在虚拟环境命令行:
set MARIADB_CC_INSTALL_DIR="C:\Program Files\MariaDB\MariaDB Connector C 64-bit"
python setup.py build
python setup.py install
推荐阅读
- wso2 - 成功认证后将用户重定向到外部页面,而不是服务提供者
- php - 如何在字符串之间拆分具有未知空间量的文本?
- python - 在 Lambda Python MediaConvert 函数上设置 ACL
- arrays - 递归而不是循环
- php - 带有开关gettype()的php输出循环数组给出奇怪的结果
- scala - 需要以制表符分隔的形式获取数组元素
- javascript - 获得两个不同的日期月份
- c++ - sizeof(function) 有意义吗?
- html - 媒体查询未从 479px 到 767px 的宽度读取?
- python - 在 Python 中通过自省向模块动态添加函数