2017-09-28 11 views
0

私は過去24時間以内にできることはすべてやったと思いますが、何も動かないようです。私はMac OS X App Bundlesを作成したいpythonスクリプトを持っています。私はpyinstallerを次のオプションで実行します: pyinstaller --onefile --windowed --exclude-module matplotlib test.py。すべてがうまくいくように見えます(出力は主にdyld:warningsの2つのINFOメッセージです)。しかし、私はアプリを実行しようとするとすぐに終了します。pyinstaller + pyqt5:「ココア」を見つけられないかロードできません

objc[24785]: Class RunLoopModeTracker is implemented in both /var/folders/gd/b5gj1m4x09b6jpb1llxk4vlr0000gn/T/_MEIOWkdrF/QtCore and /usr/local/Cellar/qt/5.9.1/lib/QtCore.framework/Versions/5/QtCore. One of the two will be used. Which one is undefined. 
objc[24785]: Class NotificationReceiver is implemented in both /var/folders/gd/b5gj1m4x09b6jpb1llxk4vlr0000gn/T/_MEIOWkdrF/QtWidgets and /usr/local/Cellar/qt/5.9.1/lib/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined. 
objc[24785]: Class QCocoaPageLayoutDelegate is implemented in both /var/folders/gd/b5gj1m4x09b6jpb1llxk4vlr0000gn/T/_MEIOWkdrF/QtPrintSupport and /usr/local/Cellar/qt/5.9.1/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined. 
objc[24785]: Class QCocoaPrintPanelDelegate is implemented in both /var/folders/gd/b5gj1m4x09b6jpb1llxk4vlr0000gn/T/_MEIOWkdrF/QtPrintSupport and /usr/local/Cellar/qt/5.9.1/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined. 
QObject::moveToThread: Current thread (0x7f9dbdbb8400) is not the object's thread (0x7f9dbbd8bc20). 
Cannot move to target thread (0x7f9dbdbb8400) 

You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded. 
This application failed to start because it could not find or load the Qt platform plugin "cocoa" 
in "". 

Available platform plugins are: cocoa, minimal, offscreen. 

Reinstalling the application may fix this problem. 
Abort trap: 6 
logout 
Saving session...completed. 

[Process completed] 

もう少し情報:test次のエラーで失敗し、生成UNIX実行可能スクリプトを実行しようと

Mac OS X: 10.11.6 
Python: 2.7.13 
qt: stable 5.9.1 (bottled) (via brew) 
pyqt: stable 5.9 (bottled) (via brew) 
pyinstaller: 3.3 (via pip) 

スクリプトtest.pyxlsxスプレッドシート(​​openpyxl)からデータを読み込み、基づいて複数の.docxファイルを作成します提供されたテンプレート(docxtpl)。それは.py.uiからpyuic5を介して変換された簡単なインターフェイスdesign.pyを持っています。

私は間違っていますか? (または何をやっていないのですか?)何が原因でしょうか?


それを修正するために私の試み:

まず、私はmatplotlibを除外しませんでしたが、それは例外RuntimeErrorの結果: RuntimeError: Path in environment MATPLOTLIBDATA not a directory [26131] Failed to execute script test

また、私はQTの二組とエラーと考えおそらくQt4が存在するためにプラグインがインストールされている可能性があります。私はQtのインストールを完全に混乱させました。 brewのqt5(python2で構築)ともう1つのmacportsのqt5-macqt4-macがありました。 qt4-macをアンインストールし、qt5-macを無効にしましたが、役に立たなかった

私はそれらのすべてがpython 2.7で構築されたことを確認するqtpyqtpyinstallerを再インストールしました。

pyinstallerに切り替える前に、私はpy2appを試しました。最初は、py2applet --make-setup test.pyを使用してセットアップファイルを作成しました。再びビルドは正常になりましたが、実行は失敗しました。コンソール(dist/test.app/Contents/MacOS/MyApp)から実行すると、一部のライブラリが見つからないことが判明しました:ImportError: No module named docxtpl pyqtパッケージpython setup.py py2app -A --packages=PyQt5を追加しても役に立ちませんでした。手動でOPTIONS = {'argv_emulation': True, 'includes':['sip','PyQt5','PyQt5.QtWidgets']}setup.pyに追加しても違いはありません。

qtプラグインの別のセットは、ユーザーごとの一時ファイルとキャッシュの場所である/var/folders/にあります。 OS Xがこれをどのように管理しているかわからないが、それを掃除するのが安全だと分かっている。だから私は、建物の前に/または、そして/または実行しても何もしないで、/var/folders/gdを掃除しました。キャッシュされたフォルダが再び現れ、qtのプラグインに干渉します。確かに、これは問題の根源だが、それを修正する方法はこれ以上ない。

答えて

0

pyinstaller 3.3とpyq3.6.3にPyQt 5.6.0を使用しても同じ問題が発生しました。 /var/folders/...の.dylibファイルは、condaインストールフォルダ内のファイルと衝突します。彼らは私がそれらを削除した後でさえ再現し続けた。

最終的にpyinstallerに--runtime-tmpdirの一時ディレクトリを指定してこの作業を完了しました。

例えばpyinstaller --onefile --windowed --runtime-tmpdir /your/temp/directory --exclude-module matplotlib test.py

関連する問題