In the Python programming language, developed programs can be converted into EXE files for specific operations. Here, we will give you a detailed introduction to the operations on converting a Python program into an EXE file, so that you can get some help.
- Analysis of basic Python String applications
- Summary of Python Process Control keywords
- Introduction to two common methods for connecting Python to a database
- Tips for sharing Python Chinese Characters
- Summary of common Python application scopes
The most common method for converting a Python program to an EXE file is py2exe, but it is on windows.
On the linux platform, you can use the freeze module that comes with python. Its usage is as follows:
Python
- < path of your freeze.py> [options] < entry file of your python program>
To find freeze. py, you can use "locate freeze"
For example:
I have five py files, under the gen directory (main. py, print. py, depot. py, gen. py, config. py), and main. py is the entry of the program.
I can convert the Python program to an EXE file in this way:
- python < path of your freeze.py> -o dist main.py
In this way, all generated files are put under the dist directory, and then
- cd dist
- make
Now we can see the exe file (gen. Generally there are more than 4 m.
You can use the strip command to slim down the exe file.
- strip gen
It may be less than 3 MB. The above describes how to convert a Python program into an EXE file.