python pyinstaller pyqt4 打包 QWindows

最近在做课设,用pyqt设计界面。然后用pyinstaller打包程序后,双击运行却总是闪退,后来将exe文件拖到cmd窗口运行,提示错误信息为

This application failed to start because it could not find or load the Qt platform plugin "windows".

废话不多说直接上解决办法。

进入你安装pyqt的路径,找到 ./plugins/platforms 目录,这个目录下包含所需的qwindows.dll文件


platforms目录

复制platforms文件夹,粘贴到打包后的文件夹中的qt4_plugins目录下


qt_plugins目录


将platforms复制到qt_plugins目录下

双击运行exe文件就可以啦~~~~