Pyinstaller 打包 exe
运行 exe 报错:
......
File "site-packages\ibm_db.py", line 10, in <module>
File "site-packages\ibm_db.py", line 9, in __bootstrap__
File "imp.py", line 343, load_dynamic
importError: DLL load failed: 找不到指定的模块
Failed to execute script **
小技巧:命令行中运行能查看报错信息
环境:Windows7 Python3.7 ibm-db 3.0.1
原因: exe 找不到动态文件 clidriver\bin 和 ibm_db.dll,
解决方案 两步
第一步:
系统路径中添加 clidriver 路径
**\site-packages\clidriver\bin
第二步:
打包时添加参数: --add-binary
Pyinstaller --add-binary **\Lib\site-packages\ibm_db_dlls\ibm_db.dll;.\ibm_db_dlls myproject.py
参考
1.Make sure everything is packaged correctly
2.PyQt5 Executable is crashing with Missing DLL
3.ImportError: DLL load failed: The specified module could not be found — IBM DB2