编程语言
首页 > 编程语言> > cx_freeze和python 3.2.2的问题?

cx_freeze和python 3.2.2的问题?

作者:互联网

我正在尝试使用cx_freeze 4.2.3冻结python 3.2.2脚本.源脚本使用了PyQt4,我不确定这是否是问题的潜在根源. Python在构建过程中崩溃.这是命令行输出:

C:\Python32\New Folder>python setup.py build

running build

running build_exe

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

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

此时,Python本身在Windows中崩溃,并显示“发送错误报告” MS对话框:

python.exe has encountered a problem and needs to close. We are sorry
for the inconvenience.

这是我的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@email.com",
    name = "app",
    options = {"build_exe": {"includes": includes,
                             "excludes": excludes,
                             "packages": packages,
                             "path": path
                            }
               },
    executables = [GUI2Exe_Target_1]
    )

关于我要去哪里的任何想法?

编辑:经过一些试验后,出现我尝试使用的图标引起问题.如果不包括图标设置,它将建立.

解决方法:

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

这对于某些人来说可能是显而易见的,但是online docs并没有详细介绍图标的所需格式.

标签:pyqt4,cx-freeze,python
来源: https://codeday.me/bug/20191201/2083516.html