2012-01-31 45 views
3

我想用cx_freeze 4.2.3来冻结一个python 3.2.2脚本。 PyQt4被源脚本使用,我不确定这是否是潜在的问题根源。在构建过程中Python崩溃。这里是命令行输出:问题与cx_freeze和python 3.2.2?

C:\ Python32 \新文件夹>蟒的setup.py建立

运行建立运行build_exe

复制Ç

:\ Python32 \ Lib \ site-packages \ cx_Freeze \ bases \ Win32GUI.exe - > build \ exe.win32-3.2 \ app.exe

复制C:\ WINDOWS \ system32 \ python32.dll - > build \ exe.win32 -3.2 \ python32.dll

Python本身崩溃在Windows在这一点上,并给出了 “发送错误报告” MS对话框:

python.exe遇到问题,需要关闭。对于由此造成的不便,我们深表歉意 。

这里是我的setup.py文件:

from cx_Freeze import setup, Executable 

GUI2Exe_Target_1 = Executable(
    script = "script.pyw", 
    initScript = None, 
    base = 'Win32GUI', 
    targetName = "app.exe", 
    compress = True, 
    copyDependentFiles = True, 
    appendScriptToExe = False, 
    appendScriptToLibrary = False, 
    icon = "icon.png" 
    ) 
excludes = ["pywin", "tcl", "pywin.debugger", "pywin.debugger.dbgcon", 
     "pywin.dialogs", "pywin.dialogs.list", "win32com.server", 
     "email"] 
includes = ["PyQt4.QtCore","PyQt4.QtGui","win32gui","win32com","win32api","html.parser","sys","threading","datetime","time","urllib.request","re","queue","os"] 
packages = [] 
path = [] 
setup(
    version = "1.0", 
    description = "myapp", 
    author = "me", 
    author_email = "[email protected]", 
    name = "app", 
    options = {"build_exe": {"includes": includes, 
          "excludes": excludes, 
          "packages": packages, 
          "path": path 
          } 
       }, 
    executables = [GUI2Exe_Target_1] 
    ) 

上我要去哪里不对任何想法?

编辑:经过一些实验后,它似乎我试图使用的图标是导致问题。如果我忽略图标设置,它会生成。

+0

我在搜索时发现了这个主题,看看这个链接它有完整的setup.py,我试了一下,现在它工作,但需要一些调整[cxFreeze](http://wiki.wxpython.org/cx_freeze) – 2012-09-09 15:37:48

回答

3

显然cx_freeze希望图标为.ico格式。如果您尝试使用.png作为图标,则构建过程将崩溃。此外,简单地将文件扩展名从.png重命名为.ico文件不起作用,您实际上已将文件转换为ico。

这可能对某些人很明显,但online docs没有详细说明所需的图标格式。

+0

我正在为cx_Freeze开发[更好的文档](http://cx_freeze.readthedocs.org/en/latest/index.html)。如果你想添加一些关于这方面的信息,从源头[在Bitbucket]上(https://bitbucket.org/takluyver/cx-freeze)开始。对于这个问题,如果你能解决这个问题至少能给出一个更好的错误信息,那将是值得欢迎的。 – 2012-02-11 19:17:10