Package a console program into a single-file executable with PyInstaller on Windows 11 and Ubuntu Linux 24.04. src/main.py prints Hello World and waits for a key press; src/release.py builds it into model/release/main (main.exe on Windows), so the result can be handed to a user who has no Python installed.

 

[Folder Structure]

  • CLAUDE.md / AGENT.md: program specification (identical content).
  • CHANGELOG.md: change log.
  • copyright.txt: copyright notice.
  • model/release/: the packaged executable produced by the build step.
  • src/: main.py, release.py, the launcher scripts, and this document.
  • venv/: Python virtual environment, created by step 1.

[Prerequisites]

  • Operating system: Windows 11 or Ubuntu Linux 24.04.
  • Python 3 and pip.
  • Python packages: pyinstaller (installed automatically by step 1).
  • Internet is needed only the first time, to download pyinstaller. No GPU required.

[Instructions]

Step 1: Create the virtual environment

Create the virtual environment and install src/requirements.txt (pyinstaller).

 

Windows 11:

src\01_venv_create.bat

Ubuntu Linux 24.04:

bash src/01_venv_create.sh

Step 2: Activate the virtual environment

Activate the environment in the current shell. On Linux you must source the script so the activation stays in effect after it finishes.

 

Windows 11:

src\02_venv_activate.bat

Ubuntu Linux 24.04:

source src/02_venv_activate.sh

Step 3: Run the console program

Run src/main.py directly from Python first. It prints Hello World and waits for a key press — confirming the program works before you package it.

 

Windows 11:

src\03_run.bat

Ubuntu Linux 24.04:

bash src/03_run.sh

Step 4: Build the executable

Run src/release.py through the launcher to package the program with PyInstaller. The build produces a single-file executable at model/release/main (model/release/main.exe on Windows); double-click it, or run it from the command line, on a machine with no Python installed.

 

Windows 11:

src\04_release.bat

Ubuntu Linux 24.04:

bash src/04_release.sh

Step 5: Remove the virtual environment

When you are finished, delete the venv/ folder to free up disk space. Re-run step 1 whenever you need the environment again.

 

Windows 11:

src\99_venv_clear.bat

Ubuntu Linux 24.04:

bash src/99_venv_clear.sh

[Usage Notes]

  • Executables are per-OS: an exe built on Windows runs on Windows only, and a Linux build runs on Linux only — build on each target platform.
  • The model/release/main.exe that ships with the SDK is the original 2022 Windows build; running step 4 replaces it with a fresh build for the current machine.
  • Single-file mode unpacks itself into a temporary folder at every launch, so the first start is slower than running the .py file.
  • Antivirus software sometimes flags freshly built PyInstaller executables; this is a known false positive of the packaging format.

This SDK is built in AppForAI - AI Dev Tools.

 

Purchase license separately:  USD 600, permanent authorization, single APP authorization, single machine authorization, one-year activation, one-year download, one-year update, one-year email technical support.