我的系统:
Windows 7,x64,Python3.3.1,PyQt4 4.10使用安装程序(py3.3-Qt5.0.1-x64),cx_freeze 4.3.1 (win-amd64 64-py3.3)
起作用的是:
..python33\lib\site-packages\cx_freeze\samples文件夹(以及相应的示例文件夹)并执行python setup.py build\simple和\tkinter (只是为了确保我没有在其他地方出错)问题:
\PyQt4示例(顺便说一句)。PyQt4app.py作为python应用程序运行得很好)\PyQt4 >>> python setup.py build最初无法工作:运行生成的PyQt4app.exe会导致错误,请求缺少的包"re“setup.py文件中。(options = {"build_exe" : {"includes" : ["atexit", "re"]}})python33.dll、Qt5Core.dll、Qt5Gui.dll、PyQt4.QtCore.pyd、PyQt4.QtGui.pyd (包括: sip、独角兽数据等等)。在这里,setup.py (未更改,除"re“包括&注释已删除)
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name = "simple_PyQt4",
version = "0.1",
description = "Sample cx_Freeze PyQt4 script",
options = {"build_exe" : {"includes" : ["atexit", "re"]}},
executables = [Executable("PyQt4app.py", base = base)])我哪里出问题了有什么建议吗?哪些补充信息将是有用的?
编辑:I通过设置base = None并通过批处理文件运行.exe来获得控制台输出。输出是:Failed to load platform plugin "windows". Available platforms are: (输出结束-没有列表或任何内容)。
那么在哪里以及如何加载这个插件呢?
发布于 2013-04-21 15:25:11
好吧-我找到了一个解决办法:
将qwindows.dll及其文件夹\platforms\qwindow.dll从..\python33\lib\site-packages\PyQt4\plugins复制到.exe所在的文件夹中。现在起作用了。
编辑:
我的setup.py现在看起来像这样,并且似乎也适用于其他情况:
import sys
from cx_Freeze import setup, Executable
base = "Win32GUI"
path_platforms = ( "..\..\..\PyQt4\plugins\platforms\qwindows.dll", "platforms\qwindows.dll" )
build_options = {"includes" : [ "re", "atexit" ], "include_files" : [ path_platforms ]}
setup(
name = "simple_PyQt4",
version = "0.1",
description = "Sample cx_Freeze PyQt4 script",
options = {"build_exe" : build_options},
executables = [Executable("PyQt4app.py", base = base)]
)https://stackoverflow.com/questions/16131684
复制相似问题