Pyinstaller: ImportError: невозможно импортировать имя QtGui
Используя последниеpyinstaller в Windows 7 сделать отдельный exe (-F) при запуске exe:
ImportError: cannot import name QtGui
В каталоге хуков pyinstaller есть специальная обработка для PyQt4, но не для PySide.
Надеемся на обходной путь для этого или что-то попробовать.
Environment
Windows 7 64-битная
Python 2.7 32-битный
PYTHONHOME = C: \ python27
PYTHONPATH = C: \ python27 \ Lib
PYTHONLIB = C: \ python27 \ LIBS \ python27.lib; C: \ python27 \ Lib \ сайт-пакеты
Steps
1. Добавьте PySide изhttp://releases.qt-project.org/pyside/1.1.1/PySide-1.1.1qt474.win32-py2.7.exe
2. Распаковатьhttps://github.com/pyinstaller/pyinstaller/zipball/develop к c: \ pyinstaller1.5.1
3. Запустите приведенные ниже команды для файла .py, содержащего просто:
from PySide import QtGui
[... или QtCore или или.]
Run
c:\pyinstaller1.5.1>pyinstaller.py -F import_test.py
108 INFO: wrote c:\pyinstaller1.5.1\import_test.spec
171 INFO: Testing for ability to set icons, version resources...
296 INFO: ... resource update available
312 INFO: UPX is not available.
4321 INFO: checking Analysis
4382 INFO: checking PYZ
4430 INFO: checking PKG
4446 INFO: building because c:\pyinstaller1.5.1\build\pyi.win32\import_test\import_test.exe.manifest changed
4446 INFO: building PKG out00-PKG.pkg
16782 INFO: checking EXE
16782 INFO: rebuilding out00-EXE.toc because pkg is more recent
16782 INFO: building EXE from out00-EXE.toc
16799 INFO: Appending archive to EXE c:\pyinstaller1.5.1\dist\import_test.exe
c:\pyinstaller1.5.1>dist\import_test.exe
Traceback (most recent call last):
File "<string>", line 23, in <module>
ImportError: cannot import name QtGui
Note
At the end of the PySide install (as admin), this message: close failed in file object destructor: sys.excepthook is missing lost sys.stderr If that is about post install it can be handled manually: c:>python.exe c:\Python27\Scripts\pyside_postinstall.py -install Generating file C:\python27\qt.conf... PySide installed in c:/python27/Lib/site-packages/PySide... The PySide extensions were successfully installed.