0

PyQT アプリケーションで jpeg サポートを有効にするには、手動でqjpeg4.dll.
dll と pyd ファイルが最終的な exe にバンドルされていない場合は正常に動作します。たとえば、py2exe を使用すると、次のことができます。

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)

ただし、同じことを行い、dll を exe にバンドルすると (を使用して"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

アプリケーションを適切にバンドルするにはどうすればよいですか?

4

2 に答える 2

2

私は同じ問題を抱えています.私が知っているように、py2exeは手がかりを提供しました: http://www.py2exe.org/index.cgi/Py2exeAndPyQt

それは次のように表示されます: ......したがって、フォルダー PyQt4\plugins\imageformats を \imageformats にコピーする必要があります。.......これは bundle_files on では機能しません。... *これは bundle_files でも​​機能しますが、Qt DLL をバンドルから除外し (dll_excludes オプションを使用)、他のメカニズム (data_files など) を介して実行可能ファイルと共にディレクトリに追加する必要があります。*

以下は、次のような私のセットアップオプションです。

    zipfile=None,
    options = { "py2exe" :{
                           "compressed":1,
                           "includes": my_includes,                           
                           "packages": my_packages,
                           "optimize":2,
                           "bundle_files":1,
                           "dll_excludes":["QtCore4.dll","QtGui4.dll","QtNetwork4.dll"]
                           }}

したがって、dist フォルダーは次のファイルで構成されます (私の場合):

  • imageformats (フォルダー、画像を処理するための qt プラグイン dll を含む)
  • QtCore4.dll
  • QtGui4.dll
  • QtNetwork4.dll
  • MyExeFile.exe
  • w9xpopen.exe

それで全部です

于 2012-05-24T13:34:54.450 に答える
0

次のように、パッケージとして追加pyqt4して、py2exe に PyQT のすべてをビルドに含めるように強制してみてください。

options={"py2exe":{
        "includes":["sip"],
        "excludes":MODULE_EXCLUDES,
        "packages":["PyQt4"],
        "bundle_files":1,
        "compressed":False,
        "xref":True}}
于 2010-02-08T14:08:46.347 に答える