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