Domanda

I am working on my first Python project and I need compile with py2exe. I wrote this setup.py code :

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")

The setup code is working, but I need to change the name of the compiled application from myapplication to project.exe. What options for py2exe change the name of output application?

È stato utile?

Soluzione

Add "dest_base" : "app_name" to your console dict as such:

   console = [
    {
        "script": "myapplication.py",                    ### Main Python script    
        "icon_resources": [(0, "favicon.ico")], ### Icon to embed into the PE file.
        "dest_base" : "app_name"
    }]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top