成语大全网 - 汉语词典 - pyinstaller 生成exe文件运行后报错:ImportError: DLL load failded

pyinstaller 生成exe文件运行后报错:ImportError: DLL load failded

简便方案:只需在代码中引用以下几个模块,封装时Pyinstaller即可自动引用,无需再次手动拷贝。

亲测封装成单文件/非单文件都已成功,省去了要封装成多文件还要往里拷贝的麻烦。我的程序不带这五个dll文件是9MB,如此一来变成23M,也不会再有pyi_rth_qt5plugins错误。

import?ctypestry:

temp1=ctypes.windll.LoadLibrary(?'DLL\\Qt5Core.dll'?)

temp2=ctypes.windll.LoadLibrary(?'DLL\\Qt5Gui.dll'?)

temp3=ctypes.windll.LoadLibrary(?'DLL\\Qt5Widgets.dll'?)

temp4=ctypes.windll.LoadLibrary(?'DLL\\msvcp140.dll'?)

temp5=ctypes.windll.LoadLibrary(?'DLL\\Qt5PrintSupport.dll'?)except:

pass