eolas/zk/Compile_Python_app_to_single_executable.md
2024-10-19 13:00:03 +01:00

617 B

tags created
python
procedural
Saturday, October 19, 2024

Compile Python app to single executable

Assume you are already using a Pip venv.

Install pyinstaller and/or add it to your requirements.txt:

souce venv/bin/activate
pip install pyinstaller
pip install -r requirements.txt

Then from root of project:

pyinstall -F src/app.py

The -F flag compiles the application to a single file containing all necessary external packages and local imports.

It outpute to /dist. Say the app is called hello, run the executable thus:

/my-python-application/dist/app