Windows 7 cx#U冻结pyqt4示例(";\samples\pyqt4";)不';行不通

Windows 7 cx#U冻结pyqt4示例(";\samples\pyqt4";)不';行不通,windows-7,64-bit,pyqt4,cx-freeze,python-3.3,Windows 7,64 Bit,Pyqt4,Cx Freeze,Python 3.3,我的系统: 使用安装程序(py3.3-Qt5.0.1-x64)的Windows 7、x64、Python 3.3.1、PyQt4 4.10、cx_freeze 4.3.1(win-amd64-py3.3) 工作内容: 在终端中导航到.python33\lib\site packages\cx\u freeze\samples文件夹(并进入相应的示例文件夹),然后执行python setup.py build 这与:\simple和\tkinter(只是为了确保我没有在其他地方出错) 问题:

我的系统:

使用安装程序(py3.3-Qt5.0.1-x64)的Windows 7、x64、Python 3.3.1、PyQt4 4.10、cx_freeze 4.3.1(win-amd64-py3.3)

工作内容:

  • 在终端中导航到
    .python33\lib\site packages\cx\u freeze\samples
    文件夹(并进入相应的示例文件夹),然后执行
    python setup.py build

  • 这与:
    \simple
    \tkinter
    (只是为了确保我没有在其他地方出错)

问题:

  • 但是我的目标是获得我的PyQt4项目的可执行文件/包,所以我在
    \PyQt4
    示例中也尝试了同样的方法(顺便说一句,PyQt4app.py与python应用程序一样完美)

  • \PyQt4>>>python setup.py build
    最初不起作用:运行生成的
    PyQt4app.exe
    会导致错误,请求丢失的包“re”

  • 随后,我将“re”包含在
    setup.py
    文件中。(
    options={“build_exe”:{“includes”:[“atexit”,“re”]}}

  • 现在它生成了一个.exe而没有抛出错误-但是运行这个.exe没有任何作用,只是保持沉默

  • cx\u freeze似乎找到了正确的依赖项:
    python33.dll
    Qt5Core.dll
    Qt5Gui.dll
    PyQt4.QtCore.pyd
    PyQt4.QtGui.pyd
    (其中包括sip、unicodedata等)

此处为
setup.py
(未更改,除了“重新”包含和删除注释)

有什么建议我哪里出了问题吗?还有什么其他有用的信息

  • 顺便说一句-链接到py2exe-但是py2exe不能与Python3.x一起使用
edit:通过设置
base=None
并通过批处理文件运行.exe,我成功地获得了控制台输出。输出为:
加载平台插件“windows”失败。可用的平台有:
(输出结束-没有列表或任何内容)


那么在哪里以及如何加载这个插件呢?

好的-我找到了一个解决方法:

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)]
    )

re
问题应该由解决。看起来平台插件是Qt5的新插件。我已经提交了一个问题来自动处理它们:
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)]
    )