使用 pyinstaller 打包 PyQt 错误的解决方案

2018-01-09 12:57:12 +08:00
 qsnow6

用 pyqt 写了个小工具,要打包给同事用。但是传过去打开后,发现报错了,提示

This application failed to start because it could not find or load the Qt platform plugin windows installing the application may fix this problem

但是本机、虚拟机都没问题,32、64bit 也都测了。于是就把问题定位到了系统环境本身的问题,百度了一翻,靠谱的答案没几个。

后面在c++ - Application failed to start because it could not find or load the QT platform plugin "windows" - Stack Overflow让到了解决办法,只需要把platforms 目录拷贝一份,放到打包好的 exe 程序目录下就 Ok 了。

顺便还解决了其他的乱七八糟的缺失 dll 的错误

...
3743 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of c:\python36-32\python36.dll
3862 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\python36-32\python36.dll
...

类似 lib not found: api-ms-win-xxxxxxxxxxxx.dll这样的提示,直接复制一份到程序所在目录就可以了。

dll 打包

为了方便后面躺坑的,把我的 dll 文件打包传上来,下载地址: https://pan.baidu.com/s/1dTBwui

资料参考

https://stackoverflow.com/questions/21268558/application-failed-to-start-because-it-could-not-find-or-load-the-qt-platform-pl

http://blog.csdn.net/liyuefeilong/article/details/44109403

http://blog.csdn.net/a359680405/article/details/45077187

3363 次点击
所在节点    Python
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/421334

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX