Rishabh Singh
HomeAboutServicesProjectsOpen SourceBlogVisitorsContact

v2025 · Next.js + Tailwind

All Posts
Home/Blog/Convert Python Program to exe
Read on Medium
PythonPyInstaller

Convert Python Program to exe

PyInstaller and auto-py-to-exe — two ways to bundle Python apps into standalone executables users can run without Python installed.

July 24, 20223 min readRishabh Singh
Python program converted to Windows .exe executable
Convert Python scripts to standalone executables — no Python installation required on the target machine.

Why Convert to exe?

Python makes building GUI apps easy with Tkinter and other libraries. But sharing them is hard: recipients need Python installed, need the right packages, need to run scripts from terminal. Converting to .exe removes all of this — users double-click and it works.

Method 1: PyInstaller (Command Line)

PyInstaller bundles a Python program and all its dependencies into a single package. The recipient doesn't need Python or any modules installed. Output: .exe on Windows, standard executable on Linux, .app on macOS. Best practice: run it from inside a virtual environment containing only your app's dependencies — otherwise PyInstaller may sweep in every package from your global Python and inflate the executable.

Step 1: Install PyInstaller

pip install pyinstaller

Step 2: Open terminal in your project folder

Right-click the folder containing your Python file → "Open in Terminal" (or cd to the folder).

Opening terminal in Python project folder
Open terminal in the folder containing your .py file before running pyinstaller.

Step 3: Run the conversion command

pyinstaller --onefile -w 'filename.py'

Replace filename.py with your actual file. Flags:

  • --onefile — bundles everything into a single .exe
  • -w — suppresses the console window (use for GUI apps)
PyInstaller running — build and dist folder creation
PyInstaller creates build/ and dist/ folders plus a .spec configuration file.

Step 4: Find your executable

PyInstaller creates three outputs:

  • dist/ — your distributable .exe file is here
  • build/ — internal metadata, useful for debugging build issues
  • filename.spec — configuration file for advanced customization
"Share only the dist/ folder contents — the build/ folder and .spec file are build artifacts, not needed by end users."

Method 2: auto-py-to-exe (GUI)

auto-py-to-exe provides a graphical browser-based interface built on top of PyInstaller. It's more accessible for beginners and makes it easy to add extra files, icons, and configure advanced options visually. The output is a built executable rather than the original source code — the GUI also provides some security by not exposing the .py directly.

Step 1: Install

pip install auto-py-to-exe

Step 2: Launch the GUI

auto-py-to-exe

This opens a browser-based interface.

auto-py-to-exe graphical interface
auto-py-to-exe launches a browser-based GUI — no command-line knowledge needed.

Step 3: Select your Python file

Click the Browse button and select your .py script.

Step 4: Choose packaging mode

One File vs One Directory option in auto-py-to-exe
Choose One File for a single portable .exe, or One Directory for apps with media assets.
  • One File — single .exe, easy to share, but media files (images, sounds) are NOT bundled — use "Additional Files" for those
  • One Directory — folder with executable and all dependencies, better for apps with asset files, faster startup (no extraction step)

Step 5: Add extra files if needed

Use the "Additional Files" menu to include images, databases, or other assets your app requires.

Step 6: Convert

Click "CONVERT .PY TO .EXE". When complete, the output path is shown — click "OPEN OUTPUT FOLDER" to access your executable.

auto-py-to-exe conversion complete with output folder
Conversion complete — click "OPEN OUTPUT FOLDER" to find your .exe file.

Method Comparison

  • PyInstaller (CLI): faster for experienced users, scriptable, CI/CD friendly
  • auto-py-to-exe (GUI): easier for beginners, visual configuration, same underlying engine
  • Both produce: platform-specific executable — build on Windows for Windows, Linux for Linux, macOS for macOS
  • One File vs One Directory: One File is simpler to share; One Directory is better for apps with bundled assets
Back to BlogRead on Medium

© 2026 Rishabh Singh · Data Scientist & AI Engineer

PrivacyGitHubLinkedInMedium