waterye

          py2exe

          py2exe is a Python distutils extension which converts python scripts into executable windows programs, able to run without requiring a python installation.

          install py2exe:  py2exe-0.6.3.win32-py2.4.exe

          hello.py
          1def sayHello( name ):
          2    print "hello, ".upper() + name + "!"
          3
          4if __name__ == '__main__':
          5    sayHello( "Water Ye" )

          hello_setup.py
           1from distutils.core import setup
           2import py2exe
           3
           4setup(    
           5    version = "0.0.6",
           6    description = "py2exe sample script",
           7    name = "say hello",
           8
           9    # targets to build
          10    # windows = ["test_wx.py"],
          11    console = ["hello.py"],
          12    )

          running
          G:\python_src> python hello_setup.py py2exe
          note: -b
          python hello_setup.py py2exe -b 2: Specifying a level of 2 includes the .pyd and .dll files into the zip-archive or the executable.
          python hello_setup.py py2exe -b 1: Using a level of 1 includes the .pyd and .dll files into the zip-archive or the executable itself, and does the same for pythonXY.dll.
           
          deploy
          復制dist下的所有文件到沒有python環境的機器即可運行

          posted on 2005-11-18 00:55 waterye 閱讀(595) 評論(0)  編輯  收藏 所屬分類: python


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 特克斯县| 德兴市| 沙坪坝区| 新兴县| 潜山县| 凉城县| 彭阳县| 七台河市| 赤水市| 木里| 阜城县| 淮安市| 黄梅县| 措勤县| 喀喇| 长顺县| 井研县| 永丰县| 安徽省| 宜兴市| 深水埗区| 乃东县| 阳谷县| 姜堰市| 卓尼县| 普宁市| 定兴县| 东山县| 四川省| 西和县| 杭锦后旗| 道孚县| 清水河县| 阳西县| 洪雅县| 仲巴县| 威信县| 丰都县| 广水市| 阆中市| 平江县|