用py2exe打包pyqt4出现的问题(转)
2014-10-11 14:19
696 查看
使用pyqt完成窗体界面很方便,但是打包成exe之后会有问题,在网上找到解决办法如下:
I found that on the web, unfortunately don't know anymore where, but it also works for me!
Obviously is the second part only a way to get the " --includes sip" parameter directly into the script, but the use of "windows" instead of "console" doesn't open a console window, but immediately a Qt window in my case.
The solution is to add PyQt4._qt to the setup function (see bellow). I found the solution for the problem here.
Another Solution to the same problem:
from distutils.core import setup import py2exe setup(windows=[{"script":"main.py"}], options={"py2exe":{"includes":["sip"]}})
I found that on the web, unfortunately don't know anymore where, but it also works for me!
Obviously is the second part only a way to get the " --includes sip" parameter directly into the script, but the use of "windows" instead of "console" doesn't open a console window, but immediately a Qt window in my case.
Fix for PyQt4
If you get the following error:ImportError: No module named _qt
The solution is to add PyQt4._qt to the setup function (see bellow). I found the solution for the problem here.
from distutils.core import setup import py2exe setup(windows=[{"script" : "app.pyw"}], options={"py2exe" : {"includes" : ["sip","PyQt4._qt"]}})
或者我们直接在源代码中加入:
import sip #程序打包需要 import decimal #程序打包需要 也是可以的。
相关文章推荐
- py2exe 打包 pyqt程序的图片(ico等) 不显示的问题
- py2exe 打包 PyQt4 的问题
- py2exe 打包 pyqt程序的图片不显示的问题
- pyinstaller 打包pyqt程序时出现的问题 python3.5 win7 64bit环境
- py2exe打包PyQt项目若干问题总结
- PyQt4 QPixmap.load/loadFromData 使用py2exe 打包后无法显示JPEG,gif等图片的问题
- pyqt程序使用py2exe打包时遇到的问题
- py2exe打包后发现 no model named sip问题(使用pyqt时)的解决方法
- 解决pyqt 打包成py2exe后在界面正常显示jpeg的问题
- 在64位windows 7中使用NAnt 打包DNN 模块出现下面的问题
- android 源码编译打包的apk出现accessed stale local reference问题
- 关于使用了QtWebKit的PyQt程序打包后无法显示网页图片的问题(Mac0S和windows)
- 打包混淆 出现第三方jar包 resource NotFoundException的问题解决办法
- py2exe打包问题
- twisted(iocp)程序在用py2exe打包时的问题
- Eclipse打包Android项目时用到proguard.cfg后,出现的Warning:can't find referenced class问题的解决方案
- py2exe打包,vista/win7下图标显示问题的解决方案
- SharePoint 2010 打包 KB2756920 出现无法访问的问题,是一个bug,要卸载掉
- py2exe打包的配置和icon不显示问题的解决方法
- android开放平台接入后项目打包中出现的问题