2017-09-28 81 views
0

지난 24 시간 동안 할 수있는 모든 작업을 수행했지만 아무 것도 작동하지 않는 것 같습니다. 나는 Mac OS X App 번들을 만들고 싶습니다. 파이썬 스크립트가 있습니다. 다음 옵션을 사용하여 pyinstaller을 실행합니다. pyinstaller --onefile --windowed --exclude-module matplotlib test.py. 모든 것이 잘 보입니다 (출력은 대부분 dyld : 경고와 함께 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). 간단한 인터페이스 인 design.py.py에서 .ui까지 pyuic5을 통해 변환되었습니다.

내가 뭘 잘못하고 있니? (또는 무엇을하지 않습니까?) 그런 문제를 일으키는 원인은 무엇입니까? 내가 matplotlib을 배제하지 않았다, 처음에는

있지만 RuntimeError에 결과 :


내 시도가 그것을 해결하기 위해 또한 RuntimeError: Path in environment MATPLOTLIBDATA not a directory [26131] Failed to execute script test

, 나는 생각했다 그 Qt는 두 세트와 오류 플러그인은 Qt4의 존재 때문일 수 있습니다. 나는 Qt 설치가 완전히 엉망이었다. brew의 qt5 (python2로 작성)과 다른 macports의 qt5-mac (qt4-mac)이있었습니다. qt4-mac을 제거하고 qt5-mac을 비활성화했지만 도움이되지 않았습니다.

qt, pyqtpyinstaller을 모두 다시 설치하여 모두 python 2.7으로 만들어 졌는지 확인하십시오.

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 및 pyqt 5.6.0을 사용하는 conda python3.6.3과 같은 문제가 발생했습니다. /var/folders/...의 .dylib 파일은 conda 설치 폴더의 파일과 충돌합니다. 그들은 삭제 한 후에도 계속 나타났다.

pyinstaller에게 --runtime-tmpdir에 임시 디렉토리를 지정하여이 작업을 마침내 얻었습니다.

예컨대 pyinstaller --onefile --windowed --runtime-tmpdir /your/temp/directory --exclude-module matplotlib test.py