cx冻结设置自定义.exe图标 [英] cx freeze set custom .exe icon
本文介绍了cx冻结设置自定义.exe图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用cx_freeze将.py文件转换为.exe文件。我当前的安装文件正在运行,但似乎无法更改它,因此.exe文件具有我创建的自定义图标。我尝试了几种不同的方法,但似乎都没有。任何建议都将非常有帮助。谢谢您的时间。
I am converting a .py file to a .exe file using cx_freeze. My current setup file is working but I can not seem to change it so that my .exe file has the custom icon I have made. I have tried a few different ways and none of them seem to be working. Any advice would be very helpful. Thank you for your time.
尝试一个
import sys
from cx_Freeze import setup, Executable
include_files = ['autorun.inf']
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(name = "Calculator",
version = "0.1",
description = "Simple Calculator",
options = {'build_exe':{'include_files':include_files,
'icon':'icon.ico'}},
executables=[Executable("main.py", base = base)])
尝试两次
import sys
from cx_Freeze import setup, Executable
include_files = ['autorun.inf']
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(name = "Calculator",
version = "0.1",
description = "Simple Calculator",
options = {'build_exe':{'include_files':include_files}},
executables=[Executable("main.py", base = base, icon = 'icon.ico')])
推荐答案
此方法应该有效:
import sys
from cx_Freeze import setup, Executable
include_files = ['autorun.inf']
base = None
if sys.platform == "win32":
base = "Win32GUI"
exe = Executable(script='main.py', base = base, icon='icon.ico')
setup(name = "Calculator",
version = "0.1",
description = "Simple Calculator",
options = {'build_exe':{'include_files':include_files}},
executables = [exe])
这篇关于cx冻结设置自定义.exe图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文