実行可能スクリプトの名前以外の実行可能ファイルに別の名前を与える

StackOverflow https://stackoverflow.com/questions/5321435

  •  24-10-2019
  •  | 
  •  

質問

次のセットアップファイルを使用して、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のような違うものになりたいです。実行可能ファイルの名前を変更すると、スクリプトが動作していません。

役に立ちましたか?

解決

を使用してみてください targetName オプション:

executables = [Executable(targetName="myexecutable.exe")]
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top