Steps to package python files into executable files under linux
1. Install PyInstaller
pip install pyinstaller
pyinstaller --version
2. Use PyInstaller to package python files
Execute the command in the same directory as myscript.py:
- pyinstaller mycript.py and you will see that two new directories have been added, build and dist. The files under dist are executable files that can be published.
- You will find a bunch of files under the dist directory, all kinds of dynamic library files and myscript executable files
-
pyInstaller supports single-file mode, just execute:
- pyinstaller -F mycript.py
- You will find that there is only one executable file under dist, this single file can be distributed and can be run under a system similar to the operating system you are using.