PyInstaller错误与PyQt的试图建立


I’m trying to compile a PyQt program using PyInstaller 1.5.我试图使用PyInstaller 1.5编译一个PyQt的程序。 Both of the following programs work fine for me when I use –onedir (the default), but this creates rather large programs.以下程序正常工作对我来说,当我使用 – onedir(默认值),但是这创造了相当大的程序。 I want to use the –onefile option, but when I run the created onefile app, I get the error:我想用 – onefile选项,但是当我运行创建的onefile应用程序,我得到的错误:

Traceback (most recent call last): File “”, line 11, in File “pyinstaller/PyInstaller/loader/iu.py”, line 468, in importHook raise ImportError(“No module named %s” % fqname) ImportError: No module named PyQt4.QtCore

This error occurs for both this:发生此错误为:

import sys from PyQt4 import QtCore, QtGui app =QtGui.QApplication(sys.argv) window =QtGui.QMainWindow() window.setCentralWidget(QtGui.QLabel(“Hello”)) window.show() sys.exit(app.exec_())

and this:和这样的:

import sys import PyQt4.QtCore, PyQt4.QtGui app = PyQt4.QtGui.QApplication(sys.argv) window = PyQt4.QtGui.QMainWindow() window.setCentralWidget(PyQt4.QtGui.QLabel(“Hello”)) window.show() sys.exit(app.exec_())

Does anyone have any ideas?没有任何人有任何想法吗?
来源:http://stackoverflow.com/questions/8548904/pyinstaller-error-with-pyqt-when-trying-to-build-onefile

1, Pyinstaller won’t create –onefile even smaller than –onedir. 1,Pyinstaller不会创造 – onefile甚至小于 – onedir。 When you run the –onefile, it just creates a wrapper that extract everything in the dir to a temporary directory and then run it.当您运行 – onefile,它只是创建一个包装在dir中提取的一切到一个临时目录,然后运行它。

2, Pyinstaller does not support import PyQt4.QtCore, PyQt4.QtGui , and from PyQt4 import QtCore, QtGui is the only supported way according to here . 2,Pyinstaller不支持import PyQt4.QtCore, PyQt4.QtGui , from PyQt4 import QtCore, QtGui是唯一支持的方法,根据这里

3, What’s your PyQt4’s version? 3,什么是您的的PyQt4的的版本吗? Is is the GPL version from Riverbank’s installer?是GPL版本从河岸的安装程序中吗?

4, Did you follow the steps correctly? 4,你有没有按照正确的步骤? eg Makespec.py then Build.py ?如Makespec.py然后Build.py吗?

普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress