为可执行文件指定与可执行脚本名称不同的名称
我正在使用以下安装文件来使用 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 的名称为 runner.exe,我希望它是不同的名称,例如 myexecutable.exe 重命名可执行文件,但脚本无法正常工作,因为脚本被包模块进一步引用。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用
targetName
选项:较新的版本请改用
target_name
,因此,如果您使用的是最新的 cx_Freeze 版本,请改用Try using the
targetName
option:more recent version use
target_name
instead, so if you're on the latest cx_Freeze version, instead use新的关键字样式是
target_name
The new style of keyword is
target_name
只需在其中使用关键字
“target_name”
Executable(target_name = "my_executable")
根据操作系统
windows 或 linux
保留可执行文件的名称Just use the keyword
"target_name"
inside theExecutable(target_name = "my_executable")
keep the name of your executable file as per the OS
windows or linux