Reverse Engineeringpythonbundlingpackagingexecutablearchivedependencies

PyInstaller

Utility to bundle a Python application into a single package or executable file. Analyzes Python scripts to discover and include all required modules and libraries.

Description

PyInstaller reads a Python script, analyzes the code to discover every module and library needed for execution, collects copies of those files, and bundles them with the script into a single folder or executable file. This package provides the executables, depending on python3-pyinstaller for the Python modules. It is useful for distributing Python applications without requiring users to install Python or dependencies manually.

The tool includes several utilities like pyi-archive_viewer for viewing archive contents, pyi-bindepend for showing bind dependencies, pyi-grab_version for extracting version info from executables, pyi-makespec for generating spec files, and pyi-set_version for setting version information. These support various aspects of building, inspecting, and modifying bundled applications, particularly for Windows and macOS targets.

python3-pyinstaller provides the core Python modules, while the pyinstaller package contains the command-line executables. Installed size for pyinstaller is 104 KB and for python3-pyinstaller is 2.35 MB.

How It Works

PyInstaller analyzes the Python script to identify imports and dependencies, collects all required modules, libraries, and data files, then bundles them into a single folder (--onedir) or standalone executable (--onefile). For onefile mode, it extracts files to a temporary directory at runtime. Utilities like pyi-archive_viewer parse and list contents of PyInstaller archives, pyi-bindepend analyzes dynamic library dependencies, and pyi-makespec generates .spec files that control bundling options such as hidden imports, data collection, and platform-specific features like console handling or code signing.

Installation

bash
sudo apt install pyinstaller

Flags

-h, --helpshow this help message and exit
-l, --listList the archive contents and exit (default: False)
-r, --recursiveRecursively print an archive log (default: False). Implies --list
-b, --briefWhen displaying archive contents, show only file names (default: False)
--log-level LEVELAmount of detail in build-time console messages. LEVEL may be one of TRACE, DEBUG, INFO, WARN, DEPRECATION
-D, --onedirCreate a one-folder bundle containing an executable (default)
-F, --onefileCreate a one-file bundled executable
--specpath DIRFolder to store the generated spec file (default: current directory)
-n, --name NAMEName to assign to the bundled app and spec file (default: first script's basename)
--add-data SOURCE:DESTAdditional data files or directories containing data files to be added to the application

Examples

Show help for pyi-archive_viewer, which views a PyInstaller archive
pyi-archive_viewer -h
Show help for pyi-bindepend, which shows PyInstaller bind dependencies for executables or dynamic libraries
pyi-bindepend -h
Show help for pyi-grab_version, which grabs the version from a PyInstaller executable
pyi-grab_version -h
Show help for pyi-makespec, which makes a PyInstaller spec file
pyi-makespec -h
Show help for pyi-set_version, which sets the version of a PyInstaller executable
pyi-set_version -h
Show help for pyinstaller, which bundles a Python application and all its dependencies into a single package
pyinstaller -h
Install the pyinstaller package containing the executables
sudo apt install pyinstaller
Updated 2026-04-16kali.org ↗