PyInstaller

6.19.0 · active · verified Thu Apr 09

PyInstaller is a versatile tool that bundles a Python application and all its dependencies into a single package, often a standalone executable. This allows distribution of Python applications to users without requiring them to install a Python interpreter or any modules. The current version is 6.19.0, and the project typically releases minor versions every 2-3 months and major versions annually.

Warnings

Install

Quickstart

PyInstaller is primarily a command-line tool. This example demonstrates how to create a simple Python script and the typical command used to bundle it into a standalone executable. After running `pyinstaller my_app.py` in your terminal, a `dist` folder will be created containing the executable.

import os

# Create a dummy Python script for demonstration
with open('my_app.py', 'w') as f:
    f.write("""
import sys
import os

def main():
    print("Hello from my bundled app!")
    print(f"Running from: {os.path.dirname(sys.executable)}")

if __name__ == '__main__':
    main()
""")

# Run PyInstaller via command line (most common use case)
# For programmatic use, you'd typically call PyInstaller.__main__.run(['my_app.py'])
# This is a shell command, not Python code to be executed directly in this context.
# You would run 'pyinstaller my_app.py' in your terminal.

view raw JSON →