Give a different name to the executable other than the name of the executable script
سؤال
I am using the following setup file to create executable using cx_freeze. Is it possible to generate the exe with a different name other than the name of the executable script?
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")]
)
So now the exe which is created has name runner.exe and i want it to be something different like myexecutable.exe Renaming the executable, ir the script is not working cause the script is further referenced by the package modules.
المحلول
Try using the targetName
option:
executables = [Executable(targetName="myexecutable.exe")]
لا تنتمي إلى StackOverflow