Home >Backend Development >Python Tutorial >Example code about py2exe packaging tool

Example code about py2exe packaging tool

零下一度
零下一度Original
2017-06-25 10:20:071435browse
下载Python对应版本的py2exe,使用这个工具可以将自己的程序打包成exe文件。

使用这个工具需要写一个用于打包的setup.py文件(名称可以自己定,不一定是setup.py),写好后在命令提示符界面cd到这个文件的目录,执行命令“python setup.py py2exe”即可打包完成。

下面是自己参考其他网友写的,可供参考:
 1 # _*_ coding: utf-8 _*_ 2 import py2exe 3 from distutils.core import setup 4  5 includes = ['encodings', 'encodings.*'] 6 options = {'py2exe': 7                {'compressed': 1, 8                 'optimize': 2, 9                 'ascii': 1,10                 'includes': includes,11                 'bundle_files': 1,12                 'dll_excludes': ['MSVCP90.dll'],13                 }14            }15 16 setup(version='1.0.0',17       description='search file',18       name='search file',19       options=options,20       zipfile=None,21       windows=[{'script': 'core\\tool.py',  # 需要打包的程序的主文件路径22                 'icon_resources': [(1, 'resource\\icon.ico')],  # 程序图标的图片路径23                 }],24       )

 

The above is the detailed content of Example code about py2exe packaging tool. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn