Home >Backend Development >Python Tutorial >How to package python into an executable file

How to package python into an executable file

coldplay.xixi
coldplay.xixiOriginal
2021-02-22 17:01:1240084browse

How to package python into an executable file: 1. Put the [.exe] file packaged by the [.py] file and related files in a directory; 2. Add [-F] After setting the parameters, package the produced [.exe] into an independent [.exe] format executable file.

How to package python into an executable file

The operating environment of this tutorial: Windows 7 system, python version 3.9, DELL G3 computer. This method is suitable for all brands of computers.

How to package python into an executable file:

1. Install PyInstaller  

pip install pyinstaller

2. PyInstaller How to use

Python packaging work PyInstaller provides two ways to package .py files into .exe files:

The first way is Put the .exe file packaged by the .py file and related files in a directory. This mode is the default mode and is called onedir mode. The syntax is:

pyinstaller 应用程序

For example:

pyinstaller Hello.py

The second method is to add the -F parameter and package the created .exe into an independent .exe format The executable file is called onefile mode. The syntax is:

pyinstaller -F 应用程序

For example:

pyinstaller -F Hello.py

Related free learning recommendations: python video tutorial

The above is the detailed content of How to package python into an 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