私は過去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.py
はxlsx
スプレッドシート(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-mac
とqt4-mac
がありました。 qt4-mac
をアンインストールし、qt5-mac
を無効にしましたが、役に立たなかった
私はそれらのすべてがpython 2.7
で構築されたことを確認するqt
、pyqt
とpyinstaller
を再インストールしました。
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のプラグインに干渉します。確かに、これは問題の根源だが、それを修正する方法はこれ以上ない。