Thursday, 22 January 2026

Create a True Windows App (.exe) Using PyInstaller

 

Create a True Windows App (.exe) Using PyInstaller

This produces:

  • A single .exe file

  • Double‑click → launches your Streamlit app

  • No need for users to install Python

  • Works offline

✅ Step 1 — Create a launcher script

Create a file named run_app.py:

python
import subprocess
import sys
import os

# Path to your Streamlit app
APP_FILE = "app.py"

# Launch Streamlit
subprocess.run([sys.executable, "-m", "streamlit", "run", APP_FILE])

✅ Step 2 — Install PyInstaller

Code
pip install pyinstaller

✅ Step 3 — Build the .exe

Run this in the folder containing run_app.py:

Code
pyinstaller --noconfirm --onefile --windowed run_app.py

What you get:

Code
dist/
   run_app.exe

Double‑click → your rainfall generator opens automatically in the browser.

No comments:

Post a Comment