1. Install Py2exe Library, method: Open https://pypi.python.org/pypi/py2exe/0.9.2.0#installation, find Py2exe-0.9.2.0.win32.exe Download the installation (installed by default in the Python source directory) and install it.
2. Create a new folder under the Python source directory (such as C:\Python34) and rename it (such as a Web folder). Put the PY source file (such as web.py) that you want to convert to exe into a folder.
3. Create a new. py source file (named tweb.py) into the Web folder, andthe code in tweb.py is:
From Distutils.core Import Setup
Import Py2exe
Setup (windows=["web.py"])
4. Open cmd and switch the current path to the C:\Python34\web directory.
5. Enter command python tweb.py py2exe, enter, cmd to execute automatically.
6. After execution, find the Dist folder inside the Web folder , there is a Web.exe file. Done.
7. Note that you must copy the entire dist to use Web.exe on other computers.
Attach the web.py code:
Import WebBrowser
Import time
Webbrowser.open ("http://www.baidu.com")
Time.sleep (5)
Webbrowser.open ("http://www.163.com")
Publish the Python exe executable file (using the Py2exe library)