简体   繁体   English

“ImportError: DLL load failed while importing mariadb: The specified module could not be found”的解决方法。

[英]Workaround for “ImportError: DLL load failed while importing mariadb: The specified module could not be found.”

After installing MariaDB Connector/Python on Windows 64-bit with Python 3.8.3 I am getting the following error in import mariadb :在使用 Python 3.8.3 在 Windows 64 位上安装 MariaDB 连接器/Python 后,我在import mariadb时收到以下错误

ImportError: DLL load failed while importing mariadb: The specified module could not be found.

Apparently this is a known issue .显然这是一个已知问题 Could you, please, help me to find a workaround until the issue is fixed?请您帮我找到解决方法,直到问题得到解决?

Listing of venv\app_name\Lib\site-packages\mariadb-0.9.58.dist-info produces the following results: 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

Apparently it doesn't look like a lot of useful stuff because there are no Python or C/C++ modules.显然它看起来不是很多有用的东西,因为没有 Python 或 C/C++ 模块。 So perhaps the installation with pip3 install --pre mariadb has failed silently (nevertheless it reported success).所以也许用pip3 install --pre mariadb失败了(尽管它报告成功)。

I have the following candidate solutions in mind:我想到了以下候选解决方案:

  1. Use MySQL Connector/Python to connect to MariaDB.使用 MySQL 连接器/Python 连接到 MariaDB。 Is this a viable solution?这是一个可行的解决方案吗?
  2. Build MariaDB Connector/Python from sources or otherwise download a pre-built package if it's available.从源代码构建 MariaDB 连接器/Python 或以其他方式下载预构建的 package(如果可用)。 But how to do this?但是如何做到这一点?

Apparently the quickest and most reliable solution (as far as I can see) was to build MariaDB Connector/Python from sources by following the steps from wiki , specifically, having MSVS 2019 and MariaDB Connector/C installed, I did the following from within the virtual environment command line:显然,最快和最可靠的解决方案(据我所知)是按照 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

This bug was caused by a small typo, instead of linking statically, MariaDB Connector/C was linked dynamically, but libmariadb.dll couldn't be loaded.这个错误是由一个小错字引起的,而不是静态链接,MariaDB Connector/C 是动态链接的,但 libmariadb.dll 无法加载。

There are actually 3 options:实际上有3个选项:

  1. Build C/Python yourself, as Serge already pointed out in his answer.正如 Serge 在他的回答中已经指出的那样,自己构建 C/Python。
  2. Install MariaDB Connector/C, and put the \lib and \lib\plugin directory in your path.安装 MariaDB Connector/C,并将 \lib 和 \lib\plugin 目录放在你的路径中。
  3. Install MariaDB Connector/Python 0.9.59-beta, which I uploaded to pypi.org just a few minutes before.安装 MariaDB Connector/Python 0.9.59-beta,几分钟前我上传到 pypi.org。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 导入 Dash 时出错:“ImportError: DLL load failed while importing _brotli: The specified module could not be found.” - Error when importing Dash: "ImportError: DLL load failed while importing _brotli: The specified module could not be found." 在pycharm ImportError中:DLL加载失败:找不到指定的模块。 导入人脸识别时 - In pycharm ImportError: DLL load failed: The specified module could not be found. while importing facerecognition 导入 tensorflow 时,出现错误“导入错误:DLL 加载失败:找不到指定的模块。” - While importing tensorflow, got the error 'ImportError: DLL load failed: The specified module could not be found.' 导入错误:DLL 加载失败:找不到指定的模块。(Keras) - ImportError: DLL load failed: The specified module could not be found.(Keras) MeCab:“ImportError:DLL 加载失败:找不到指定的模块。” - MeCab: “ImportError: DLL load failed: The specified module could not be found.” MeCab:“ ImportError:DLL加载失败:找不到指定的模块。” - MeCab: “ImportError: DLL load failed: The specified module could not be found.” ImportError:DLL加载失败:找不到指定的模块。 在pycharm中导入cv2时 - ImportError: DLL load failed: The specified module could not be found. when importing cv2 in pycharm 导入 Cartopy 时 ImportError: DLL load failed while importing trace: The specified module could not be found - When importing Cartopy ImportError: DLL load failed while importing trace: The specified module could not be found cx_Freeze ImportError: DLL load failed while importing _ctypes: 找不到指定的模块 - cx_Freeze ImportError: DLL load failed failed while importing _ctypes: The specified module could not be found (ibm_db) ImportError: DLL load failed while importing ibm_db: The specified module could not be found - (ibm_db) ImportError: DLL load failed while importing ibm_db: The specified module could not be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM