Home >Backend Development >Python Tutorial >How to make python executable file

How to make python executable file

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-18 10:48:0512197browse

Executable file (executable file) refers to a file that can be loaded and executed by the operating system. In different operating system environments, executable programs are presented differently. Under the Windows operating system, the executable program can be an .exe file, a .sys file, or a .com type file.

How to make python executable file

The following takes the exe file as an example:

First enter py2exe and download the plug-in. Pay attention to the downloaded plug-in version. Must be consistent with your own python version.

How to make python executable file

Then write a python code script, which mainly implements the printing function from 1 to 9.

Related recommendations: "python video tutorial"

How to make python executable file

Then enter cmd on the local computer, and then enter the specified python directory Run the python test code file.

How to make python executable file

Then write a setup script. The script file is named setup.py and placed in the same directory as the previous Ttest.py.

How to make python executable file

Then execute the following code python setup.py py2exe in cmd.

How to make python executable file

The main function of this code is to generate the .exe file, and then you can find the Ttest.exe file under dist.

How to make python executable file

The above is the detailed content of How to make python executable file. 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