Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


pyinstaller

pyinstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules. pyinstaller supports Python 3.6 or newer, and correctly bundles the major Python packages such as numpy, pyqt, and others.

Reference(s)

Table of contents


Install

Warning

Try to not use $ pip install ... system wide. Prefer your system package manager instead, or pip+venv (see pip and venv).

Tip

If $ pip insall ... is needed outside a venv: then use the --user flag.

$ pip install pyinstaller
$ poetry add --dev pyinstaller

TODO


Use

Package your Python program into a single executable file with the following command:

$ pyinstaller --clean --onefile main.py

Troubleshooting

If you encounter the following error:

ModuleNotFoundError: No module named 'epics.clibs'

Then the missing module might be hidden, re try like so:

$ pyinstaller --clean --onefile --hidden-import epics.clibs main.py


If this cheat sheet has been useful to you, then please consider leaving a star here.