要在PyQT应用程序中启用jpeg支持,您必须手动包含qjpeg4.dll
。
当最终的exe文件没有将dll和pyd文件捆绑在一起时,它工作正常。例如 与py2exe,你可以做到以下几点:pyqt jpeg支持不以捆绑形式工作
DATA=[('imageformats',['C:\\Python26/Lib/site-packages/PyQt4/plugins/imageformats/qjpeg4.dll'])]
setup(console=[{"script":"cycotic.py"}],
data_files = DATA,
options={"py2exe":{
"includes":["sip"],
"excludes":MODULE_EXCLUDES,
"bundle_files":3,
"compressed":False,
"xref":True}},
zipfile=None)
但是,如果你做同样的事情,而你在exe文件捆绑的DLL(使用"bundle_files":1
)时,出现以下消息:
QObject::moveToThread: Current thread (0x3a16608) is not the object's thread (0x
2dddaf8).
Cannot move to target thread (0x2dddaf8)
QObject::moveToThread: Current thread (0x3a16608) is not the object's thread (0x
2dddaf8).
Cannot move to target thread (0x2dddaf8)
QObject::moveToThread: Current thread (0x3a16608) is not the object's thread (0x
2dddaf8).
Cannot move to target thread (0x2dddaf8)
QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::end: Painter not active, aborted
QPixmap::scaled: Pixmap is a null pixmap
如何正确捆绑应用程序?
修改pyqt - > PyQt4有一个有效的包名称,但失败了。显然PyQt4不喜欢被包含这种方式。它失败: 错误:编译'C:\ Python26 \ lib \ site-packages \ PyQt4 \ uic \ port_v3 \ proxy_base.py' 失败 SyntaxError:无效语法(proxy_base.py,第4行) – shodanex 2010-02-08 14:53:41
这是一个proxy_base.py中的错误?将proxy_base添加到您的Excludes并查看它是否构建 – 2010-02-08 15:30:26