First, Introduction:
Py2exe is a tool for converting a Python script into a standalone executable program (*.exe) on Windows so that you can run the executable program on a Windows system without having to install Python.
Py2exe has been used to create wxpython,tkinter,pmw,pygtk,pygame,win32com client and server, and other standalone programs.
Second, installation Py2exe:
Download and run the Py2exe version of the installer that corresponds to the python you installed from Http://prdownloads.sourceforge.net/py2exe, which installs Py2exe and the corresponding example, which are installed in lib\ The Site-packages\py2exe\samples directory.
Third, the use of Py2exe:
If you have a name of Gj_check_ version.py.py python script, you want to convert it to an executable program running on Windows and run on a Windows system that doesn't have Python installed, first you should write a setup script for the publisher, such as: setup.py, which is inserted before the setup function. Sentence import Py2exe.
The setup.py example is as follows:
from Import Setup Import py2exesetup (console=["gj_check_version.py"])
Open the command line, navigate to the directory where the. py file is located, and enter the command:
Python setup.py Py2exe
By default, Py2exe creates the following required files under Directory dist:
python-Convert to EXE (Py2exe)