【问题标题】:py2exe change application name outputpy2exe 更改应用程序名称输出
【发布时间】:2014-03-31 15:19:27
【问题描述】:

我正在开发我的第一个 Python 项目,我需要使用 py2exe 进行编译。我写了这个 setup.py 代码:

from distutils.core import setup
import py2exe
import sys
import os 

if len(sys.argv) == 1:
    sys.argv.append("py2exe")

setup( options = {"py2exe": {"compressed": 1, "optimize": 2,"dll_excludes": "w9xpopen.exe",'dist_dir': "myproject", "ascii": 0, "bundle_files": 1}},
       zipfile = None,

       console = [
        {
            "script": "myapplication.py",                    ### Main Python script    
            "icon_resources": [(0, "favicon.ico")]     ### Icon to embed into the PE file.
        }
    ],)

os.system('upx -9 dist/*.exe')
os.system("rmdir /s /q build")
os.system("del /q *.pyc")

安装代码正在运行,但我需要将已编译应用程序的名称从 myapplication 更改为 project.exe。 py2exe 的哪些选项可以更改输出应用程序的名称?

【问题讨论】:

  • 将name参数设置为设置函数setup(name="project", ...的参数

标签: python py2exe


【解决方案1】:

将"dest_base" : "app_name" 添加到您的控制台字典中:

   console = [
    {
        "script": "myapplication.py",                    ### Main Python script    
        "icon_resources": [(0, "favicon.ico")], ### Icon to embed into the PE file.
        "dest_base" : "app_name"
    }]

【讨论】:

  • 我在文档中找不到它。你知道哪里详细吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-11-28
  • 2022-09-28
  • 1970-01-01
  • 1970-01-01
  • 2021-07-11
  • 2012-07-09
  • 1970-01-01
相关资源
最近更新 更多