要在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