2013-07-26 3 views
2

나는이 게시물에 비슷한 문제에 봉착는 :pyInstaller 중에 및 PySide와 QtGui

Pyinstaller: ImportError: cannot import name QtGui

...하지만이 게시물은 해결책이 나타나지 않습니다. 나는 매우 간단 PySide 스크립트 (helloWorld.py)를 설치 pyInstaller 중에 사용할 수 없습니다 :

#!/usr/bin/python 
import sys 
from PySide import QtGui 
from PySide import QtCore 
app = QtGui.QApplication(sys.argv) 
label = QtGui.QLabel("Hello Plain World") 
label.show() 
app.exec_() 
sys.exit() 

을 내가 실행

]$ ./makespec.py -F helloWorld.py 
]$ pyinstaller helloWorld.Spec 

생성하는이 성공적으로 실행 파일을 생성

fatal: Not a git repository (or any of the parent directories): .git 
20 INFO: UPX is not available. 
34 INFO: Processing hook hook-os 
103 INFO: Processing hook hook-time 
104 INFO: Processing hook hook-cPickle 
156 INFO: Processing hook hook-_sre 
245 INFO: Processing hook hook-cStringIO 
308 INFO: Processing hook hook-encodings 
316 INFO: Processing hook hook-codecs 
599 INFO: Extending PYTHONPATH with /home/derek/BitBucketRepos/tmp/qvt/pyinstaller/tmp 
599 INFO: checking Analysis 
599 INFO: building Analysis because out00-Analysis.toc non existent 
599 INFO: running Analysis out00-Analysis.toc 
632 INFO: Analyzing /home/derek/BitBucketRepos/tmp/qvt/pyinstaller/PyInstaller/loader /_pyi_bootstrap.py 
643 INFO: Processing hook hook-os 
652 INFO: Processing hook hook-site 
661 INFO: Processing hook hook-encodings 
726 INFO: Processing hook hook-time 
727 INFO: Processing hook hook-cPickle 
780 INFO: Processing hook hook-_sre 
871 INFO: Processing hook hook-cStringIO 
939 INFO: Processing hook hook-codecs 
1272 INFO: Processing hook hook-pydoc 
1358 INFO: Processing hook hook-email 
1398 INFO: Processing hook hook-httplib 
1430 INFO: Processing hook hook-email.message 
1476 INFO: Analyzing /home/derek/BitBucketRepos/tmp/qvt/pyinstaller/PyInstaller/loader /pyi_importers.py 
1515 INFO: Analyzing /home/derek/BitBucketRepos/tmp/qvt/pyinstaller/PyInstaller/loader /pyi_archive.py 
1542 INFO: Analyzing /home/derek/BitBucketRepos/tmp/qvt/pyinstaller/PyInstaller/loader /pyi_carchive.py 
1570 INFO: Analyzing /home/derek/BitBucketRepos/tmp/qvt/pyinstaller/PyInstaller/loader /pyi_os_path.py 
1573 INFO: Analyzing helloWorld.py 
1575 INFO: Processing hook hook-PySide 
1575 INFO: Hidden import 'codecs' has been found otherwise 
1575 INFO: Hidden import 'encodings' has been found otherwise 
1575 INFO: Looking for run-time hooks 
objdump: section '.dynamic' mentioned in a -j option, but not found in any input file 
2579 INFO: Using Python library /usr/lib/libpython2.7.so.1.0 
2579 INFO: Adding Python library to binary dependencies 
2964 INFO: Warnings written to /home/derek/BitBucketRepos/tmp/qvt/pyinstaller/tmp/build /helloWorld/warnhelloWorld.txt 
2968 INFO: checking PYZ 
2968 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing 
2968 INFO: building PYZ (ZlibArchive) out00-PYZ.toc 
3329 INFO: checking PKG 
3329 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing 
3329 INFO: building PKG (CArchive) out00-PKG.pkg 
objdump: section '.dynamic' mentioned in a -j option, but not found in any input file 
10614 INFO: checking EXE 
10614 INFO: rebuilding out00-EXE.toc because helloWorld missing 
10614 INFO: building EXE from out00-EXE.toc 
10614 INFO: Appending archive to EXE /home/derek/BitBucketRepos/tmp/qvt/pyinstaller  /tmp/dist/helloWorld 

하지만, 내가 그것을 실행할 때 나는 다음과 같은 결과를 얻는다 :

Traceback (most recent call last): 
File "<string>", line 4, in <module> 
ImportError: cannot import name QtGui 

내 시스템은 Linux Mint 15 (우분투 13.04)이며, PySide와 PySide-dev가 설치되어 있고 꽤 많이 사용되었다. pyinstaller 2.0을 사용하고있다.

어떤 도움이든지 크게 도움이 될 것입니다.

데릭

+0

내가 함께 PySide 애플리케이션을 패키징 어떤 문제가 없었어요 [** 나 cx_Freeze **] (HTTP : // CX-동결. sourceforge.net/). –

답변

0

이것은 분석에서 감지 할 수없는 숨은 가져 오기와 관련이 있습니다. 설명서에서 :

수입이 모두 있지만 수입 오류가있는 응용 프로그램에서 오류가 발생했습니다. 문제는 숨겨진 가져 오기입니다. 즉, 가져 오기는 분석 단계에서 볼 수 없습니다. 코드가 임포트 또는 exec 또는 eval을 사용하는 경우 숨겨진 가져 오기 이 발생할 수 있습니다. 경고 메시지가 표시됩니다 (빌드 타임 메시지 참조). 확장 모듈이 Python/C API를 사용하여 가져 오기를 수행 할 때 숨겨진 가져 오기 도 발생할 수 있습니다. 이 경우 Analysis는 아무 것도 탐지하지 못합니다. 경고가없고 런타임에 충돌 만 있습니다. 이러한 숨겨진 가져 오기를 찾으려면 에 -v 플래그를 설정하십시오 (위의 Python의 가져 오기 가져 오기). 이 무엇인지 알았 으면 --hidden-import = 명령 옵션을 사용하거나, spec 파일을 편집하거나, 훅 파일 (아래 훅 파일 사용 참조)을 사용하여 필요한 모듈을 번들에 추가합니다. 추가 귀하의 사양 파일의 분석 섹션에 다음

시도가 :

hiddenimports=['PySide.QtCore','PySide.QtGui'] 
+0

동일한 문제가 있으며 숨겨진 가져 오기를 추가해도 도움이되지 않습니다. –

관련 문제