PyQt 应用程序:使用 py2exe 编译后不显示 gif 文件
由于某种原因,在我的系统(Windows XP 32 位,Python 2.6)上,PyQt 在 python 解释器中运行时能够完美显示 gif,但是当我通过 py2exe 运行它时,它们不再显示。
我已经尝试了我在谷歌上搜索到的所有内容:将 gif DLL 从 PyQt 复制到 imageformats/ 文件夹中,设置 qt.conf (如另一个 stackoverflow 线程建议的那样),对 imageformat DLL 所在的位置执行 setLibraryPaths ,复制安装文件来自 http://wiki.wxpython.org/py2exe-python26 。
似乎什么都不起作用——我到底做错了什么?
For some reason on my system (Windows XP 32-bit, Python 2.6) PyQt is able to display gifs perfectly when run in the python interpreter, but when I run it through py2exe, they no longer display.
I've tried everything I've googled: copying the gif DLLs from PyQt into an imageformats/ folder, setting up a qt.conf (as another stackoverflow thread suggested), done a setLibraryPaths to where the imageformat DLLs were, copied the setup file from http://wiki.wxpython.org/py2exe-python26 .
Nothing seems to work -- what on earth could I be doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定你是如何用 py2exe 编译 PyQt 的;我没有成功,并切换到 pyinstaller。
Py2exe 与 PyQt 合作不佳,并且拒绝根据所具有的小部件进行编译。
我建议切换到 pyinstaller 来编译 PyQt;看看在这种情况下它是否允许你想要的
I'm not sure how you even managed to compile PyQt with py2exe; I had no success, and switched to pyinstaller.
Py2exe wasn't cooperating well PyQt and refused to compile depending on what widgets were featured.
I'd recommend switching to pyinstaller for compiling PyQt; see if it allows what you want in this case
以防万一有人遇到这种情况,我找到了解决方案。这些是使用 py2exe 编译时需要执行的操作,以便显示图像文件:
dist\imageformats
对于 dll 文件,您需要在 setup.py 文件中进行设置:
Just in case anyone is in this situation, I found the solution. These is what you need to do when compiling with py2exe so your image files are shown:
dist\imageformats
For the dll files you need to set this on your setup.py file: