Skip to main content
 首页 » 编程设计

python之CX_Freeze : Python. exe 没有响应

2025年05月04日25zdz8207

我正在尝试将我的文本编辑器转换成一个 exe 来出售它,但是当我尝试在 cmd 中转换它时 Windows 说 python.exe 没有响应。

我的文件名为 arshi.py。

下面是我的setup.py:

import sys 
from cx_Freeze import setup, Executable 
 
base = None 
if (sys.platform == "win32"): 
    base = "Win32GUI" 
 
exe = Executable( 
        script = "arshi.py", 
        icon = "icon.PNG", 
        targetName = "Arshi.exe", 
        base = base 
        ) 
 
setup( 
    name = "Arshi Editor", 
    version = "0.1", 
    description = "A lightweight text editor for Python", 
    author = "Henry Zhu", 
    options = {'build_exe': {"packages": ["pygments"]}}, 
    executables = [exe] 
) 

请您参考如下方法:

cx_freeze 不接受.png 文件,而只接受.ico 文件。将 .png 文件转换为 .ico 文件对我来说效果很好。