【发布时间】:2020-08-06 05:38:27
【问题描述】:
在 Python 或 Internet 连接不可用的服务器中将我的 python 文件作为 exe 文件运行时,我观察到“DLL LOAD FAILED 错误消息。我的其他 exe 文件没有任何问题,这个包含 IBM DB 模块的文件是只有一个有问题。
我尝试了这里给出的解决方案:ImportError: DLL load failed: The specified module could not be found -- IBM DB2 - 仍然面临着麻烦。
当我在本地机器(笔记本电脑)上运行同一个 exe 文件时 - 它可以工作,但在服务器中 - 它不工作。
下面是我用来转换exe文件的命令:
pyinstaller -y --additional-hooks-dir=. --hidden-import ibm_db_sa.ibm_db --hidden-import ibm_db_dbi --hidden-import ibm_db --add-binary C:\Python\Python37\Lib\site-packages\ibm_db_dlls\ibm_db.dll;.\ibm_db_dlls --onefile mypythonfile.py
下面是我运行exe文件时的错误信息:
E:\SuspenseReport>mypythonfile.exe
c:\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py:62
3: MatplotlibDeprecationWarning:
The MATPLOTLIBDATA environment variable was deprecated in Matplotlib 3.1 and wil
l be removed in 3.3.
Traceback (most recent call last):
File "mypythonfile.py", line 14, in <module>
import ibm_db
File "c:\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importe
rs.py", line 623, in exec_module
File "site-packages\ibm_db.py", line 10, in <module>
File "site-packages\ibm_db.py", line 9, in __bootstrap__
File "imp.py", line 342, in load_dynamic
ImportError: DLL load failed: The specified module could not be found.
[16360] Failed to execute script mypythonfile
版本:
Python Version: 3.7.6
Pyinstaller Version: 3.6
ibm-db Version: 3.0.1
os : Windows
请告知可以采取哪些措施来解决此问题。
【问题讨论】:
标签: python python-3.x dll db2 pyinstaller