2013-05-31 49 views
0

非常好,任何人都知道,如果我可以让EXE单件的代码在脚本的一部分,例如:蟒蛇EXE转换代码

一个文件(hello.py):

print('hello word') 

def exit(): 
    print('good bye') 

两种文件(setup.py):

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


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


options = { 
    #"bundle_files": 1, 
    "dll_excludes": ["w9xpopen.exe"] # we don't need this 
    } 

setup(name = "python", 
    description = "aplicacion python", 
    version = "1.0", 
    console = [ 
     { 
      "script":"hello.exit()", 
      #"icon_resources": [(0, "res_python.ico")] 
     } 
    ], 
    options = {"py2exe": options}, 
    zipfile = None, 

    ) 

一个更好的解释,我创建相同的文件exe文件,谢谢。

+0

你的问题是什么?有什么问题吗?任何错误消息? –

+0

不会留下任何错误消息,但dist文件夹显示为空,没有创建exe文件,并在此行注意:“script”:“hello.exit()”, – Francisco

+0

请显示您的执行'setup.py'的命令。请出示通知。 –

回答

0

文件setup.py:

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

main = shell.shell() 

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


options = { 
    #"bundle_files": 1, 
    "dll_excludes": ["w9xpopen.exe"] # we don't need this 
    } 

setup(name = "python", 
    description = "aplicacion python", 
    version = "1.0", 
    console = [ 
     { 
      "script":"main.conexion()", 
      #"icon_resources": [(0, "res_python.ico")] 
     } 
    ], 
    options = {"py2exe": options}, 
    zipfile = None, 

    ) 

空闲响应:

运行py2exe 创建C:\ Documents和Settings \旧金山\ Escritorio \计划成蟒\ mis_proyectos \壳反向\建立 创建C:\ Documents and Settings \ francisco \ Escritorio \ programas python \ mis_proyectos \ shell reverse \ build \ bdist.win32 正在创建C:\ Documents and Settings \ francisco \ Escritorio \ programas python \ mis_proyectos \ shell reverse \ build \ bdist.win32 \ winexe 正在创建C:\ Documents and Settings \ francisco \ Escritorio \ programas python \ mis_proyectos \ shell reverse \ build \ bdist.win32 \ winexe \ collect-2.7 正在创建C:\ Documents and Settings \ francisco \ Escritorio \ programas python \ mis_proyectos \ shell reverse \ build \ bdist.win32 \ winexe \ bundle-2.7 正在创建C:\ Documents and Settings \ francisco \ Escritorio \ programas python \ mis_proyectos \ shell reverse \ build \ bdist.win32 \ winexe \ temp 正在创建C:\ Documents和设置\旧金山\ Escritorio \计划成蟒\ mis_proyectos \壳反向\ DIST 搜索所需模块

0

Python中之前固体蛇HD使用为实施了破坏python文件的尝试。