Objective: To run a python program on a machine without a python environment installed.
Linux generally comes with python, so it refers to the package release in windows.
Tool: py2exe ,.
Python2.7 is used here. Be sure to download the Python version consistent with that installed on your computer.
If other versions are installed, search by yourself.
Steps:
# How to publish a python program in Windows
#1. Select the program to be released. Assume that its complete path is ppath. Here it is assumed that it is ppath = "D: // nettest. py"
#2. Create a file named setup. py. The file path is random. Assume It is D: \ codes \ Python \ setup. py.
Content:
From distutils. Core import setupimport py2exeppath = "D: // nettest. py" # It is the python Program Setup (console = [ppath]) You want to package.
#3. Enter the win DOS window, that is, the Command Prompt window (note that it is not the python Command Prompt window), switch to the python installation path (the local machine is C: // python27)
#4. Run the following command and enter D: \ codes \ Python \ setup. py py2exe in the Command Prompt window
A large amount of information is generated, indicating that the package is in progress.
#5. generate a new folder Dist under the python installation path, which is the program to be released
#6. You need to publish the entire folder to run it in an environment where python is not installed.
#7. You can directly write a batch to facilitate subsequent release.