我正在使用以下设置文件使用CX_FREEZE创建可执行文件。是否可以使用可执行脚本的名称生成其他名称的EXE?

from cx_Freeze import setup, Executable 
import xlrd  
buildOptions = dict(                 
                 compressed = True,
                 optimize=2,                 
                 path=sys.path+[".\\uitls", “.\\supported”], 
                 include_files=[“Doc"],                 
                 includes=[“xlrd”, "win32com"],
                 packages=["utils", ”supported"],
                 append_script_to_exe=True,
                 copy_dependent_files=True,
                  ) 
setup(
                 name = "TestExecutable",
                 version = "0.1",
                 options = dict(build_exe = buildOptions),
                           executables = [Executable(script=r".\\codebase\\runner.py",
                           icon=".\\icon.ico",
                           base="Win32GUI")]                
     )  

因此,现在创建的exe具有name runner.exe,我希望它与myExecutable.exe更重命名可执行文件,ir脚本无法正常工作,因为脚本是由软件包模块进一步引用的。

有帮助吗?

解决方案

尝试使用 targetName 选项:

executables = [Executable(targetName="myexecutable.exe")]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top