How to Convert Python to EXE: Runcell, PyInstaller, Nuitka, and cx_Freeze
Updated on

To convert Python to EXE, start with the Runcell Python to EXE converter (opens in a new tab). Add a .py file, project folder, or ZIP, choose the script that starts your app, review its dependencies, and select Build Windows EXE. Download the result and share it with Windows users who do not have Python installed.
An EXE packages your program with the runtime and files it needs. Renaming script.py to script.exe does not do that. This guide walks through Runcell first, explains how a browser generates the binary, and gives commands for three local packaging tools. Runcell is a Kanaries product, and this is our recommended browser workflow.
- How to Convert Python to EXE: Runcell, PyInstaller, Nuitka, and cx_Freeze
- pandas 3.1 Upgrade Guide: Fix the inplace Pandas4Warning, Use df.select() and pd.col(), and Read CSVs Faster
- How to Upgrade to OpenCode 2.0: Migrate Your v1 Config, Plugins, and Sessions
- Qwen3.8 27B: Specs, Memory Requirements, and How to Run It
- Haiku pricing: Haiku 5.5 vs 4.5 vs GPT-6 Luna
- Python 3.15 Upgrade Guide: Install with uv, Use Lazy Imports, and Check Your Data Stack
- Claude Code Mods Tutorial: Build and Test Your First Mod, Plus 15 Community Examples
- How to Use Pi Coding Agent 1.0: Install, Connect a Model, and Run Your First Task
- How to Use Laya: Classify Text in a pandas DataFrame with the Open-Source Jev Alternative
- Claude Code Reads AGENTS.md Now: Setup, Loading Modes, and Sharing One File with Codex, OpenCode, and Cursor
- How to View Deleted Reddit Posts (2026 Guide): 5 Ways That Still Work
- GPT Image 2.5: How to Use It, Flare vs Sunburst, and API Pricing
- How to Use DeepSeek Harness: Install, Set Up, and Run Your First Agent
- Runcell Science: An Open Source Alternative to Claude Science for Research Workflows
- How to Make Mac Not Sleep: Keep Codex, Claude Code, and AI Agents Running
- OpenClaw vs ZeroClaw vs Pi Agent vs Nanobot: Which AI Agent Stack Should You Choose in 2026?
- Can Claude Code Analyze Jupyter Notebooks for Data Science? What It Actually Does
- Claude Code Routines: Why AI Agent Cron Jobs Matter
- Claude Code Desktop Bypass Permissions: How to Enable It
- How to Build Two Python Agents with Google’s A2A Protocol - Step by Step Tutorial
- Top 10 growing data visualization libraries in Python in 2025
Choose a Python to EXE method
| Method | Choose it when | Where you build |
|---|---|---|
| Runcell (opens in a new tab), our first choice | You have a console (command-line) script or project and want a Windows x64 EXE without installing a packager | In your browser, on your device |
| PyInstaller | You want a Python command that produces a folder or single executable, or you are packaging a GUI app (Tkinter, PySide/PyQt) | A Windows Python environment for a Windows build |
| Nuitka | You want to compile Python and configure a native compiler toolchain | A Windows Python environment plus a supported C compiler |
| cx_Freeze | You want to distribute an application folder and maintain its build configuration | A Windows Python environment for a Windows build |
The commands below use Windows PowerShell. Only the local methods require you to set up those packaging tools yourself.
Method 1: Convert Python to EXE with Runcell
Start with a small, reproducible script
Save this example as receipt.py. It prints a receipt, calculates the total, and waits for Enter so a double-clicked console window stays open. It has no third-party dependencies or extra files.
items = {"Notebook": 19.50, "Cable": 8.25, "Stand": 12.25}
print("Receipt")
for name, price in items.items():
print(f"{name}: ${price:.2f}")
print(f"Total: ${sum(items.values()):.2f}")
input("Press Enter to close...")If you already have Python installed, check the source before packaging it:
python receipt.pyThe total should be Total: $40.00. Press Enter to finish. Our guide to running Python scripts covers terminal setup if this is your first script.
Add the project and build
- Open the Runcell Python to EXE converter (opens in a new tab) and go to the converter on the page.
- Choose your
receipt.pyfile. For an existing console application, select its project directory or ZIP instead, including the modules and resources it uses. - Select
receipt.pyas the entry script. In a larger project, this is the script you normally run to start the application, such asmain.py. - Review the detected imports, dependencies, and included files. The receipt example needs no additional packages. For your own app, check that required assets and package versions match the project you intend to distribute. Runcell's runtime is Python 3.14, so each package needs a wheel that works on Windows with Python 3.14 (a
cp314,abi3, or pure-Python wheel). - Select Build Windows EXE, then download the generated executable. Open it on Windows and check the receipt output before sharing it.
In our browser check, Runcell generated and downloaded receipt.exe. Its file header identifies it as a Windows x64 executable. We did not run that EXE on Windows.
For projects with several files, keep the directory structure intact. A template loaded from templates/invoice.html needs to be included at the path your application expects.
How a browser generates a Windows EXE
Runcell's own packaging engine combines a precompiled Windows launcher, a Python runtime, your project files, and dependencies. It assembles those components into a downloadable .exe on your device. The Windows components are already compiled, so the browser can construct the final binary without running a Windows compiler locally.
The workflow has two separate stages:
Your Python project + dependencies
+
Python runtime + precompiled Windows launcher
|
v
Runcell assembles the EXE in your browser
|
v
Download the file, then run it on WindowsGenerating a file and executing it are different operations: the browser assembles the executable, and Windows runs the finished application. The Runcell mechanism guide (opens in a new tab) describes this packaging path.
What stays on your device
Runcell builds the EXE in your browser. If your project imports a module its embedded Windows runtime does not include, the converter tells you before building; remove that import or use one of the local packagers below.
Your source code and secrets stay on your device during the build. The finished EXE contains your code, so do not bundle secrets you would not share.
Method 2: Build locally with PyInstaller
PyInstaller (opens in a new tab) collects your script, its imports, and the Python runtime into a distributable application. For a Windows EXE, run PyInstaller on Windows. It builds for the operating system on which it runs.
Open PowerShell in the folder containing receipt.py. Create a virtual environment and install PyInstaller into it. If you installed Python from python.org, the py launcher works even when python is not on PATH, and calling the environment's Python directly avoids an activation step:
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install pyinstaller
.\.venv\Scripts\python.exe -m PyInstaller --onefile receipt.pyThe result is dist\receipt.exe. Run it from PowerShell to see its output:
.\dist\receipt.exeFor your own project, install its dependencies into the same environment before building. If it has a requirements.txt, use .\.venv\Scripts\python.exe -m pip install -r requirements.txt.
The case-sensitive -m PyInstaller invocation is documented in the installation guide (opens in a new tab). It keeps the packager and your dependencies in the same Python environment.
Choose console, GUI, or a folder build
Keep console mode for receipt.py because it uses print() and input(). For a graphical application that handles all interaction in its own windows, --windowed hides the console. Start with --onedir when you want to inspect the application and supporting files in a folder, then use --onefile for a single download. See the PyInstaller options reference (opens in a new tab).
To include an assets directory, add it explicitly:
.\.venv\Scripts\python.exe -m PyInstaller --onefile --add-data "assets:assets" receipt.pyThat example assumes you have created an assets folder. For bundled read-only files, resolve paths relative to __file__ as described in PyInstaller's runtime guide (opens in a new tab). Our Python pathlib guide explains the path operations.
Method 3: Compile and package with Nuitka
Nuitka (opens in a new tab) compiles Python and can create distributable applications. Choose it when you want control over a compiler-based build. You need a supported C compiler; on Windows, the manual lists Visual Studio 2022 or later as one option. The manual also says MinGW64 does not work with Python 3.13 or newer without an experimental flag, so on current Python plan on installing the Visual Studio Build Tools.
In the same kind of virtual environment, install Nuitka and request its one-file mode:
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install nuitka
.\.venv\Scripts\python.exe -m nuitka --mode=onefile receipt.pyThe expected Windows output is receipt.exe. Use --mode=standalone if you prefer a distribution folder. Set one of these modes explicitly: Nuitka's default accelerated mode is not the mode for distributing an application to a machine without Python. Follow the official manual for compiler setup and package-specific options.
Method 4: Create an application folder with cx_Freeze
cx_Freeze (opens in a new tab) normally produces a directory containing the executable and its supporting libraries. Choose it when you want to maintain a configured application build and distribute the whole folder.
In the same kind of virtual environment, install the package and run its command-line builder:
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install cx-Freeze
.\.venv\Scripts\cxfreeze.exe --script receipt.py --target-dir distThis follows the current cxfreeze command reference (opens in a new tab). Distribute the complete dist folder, including its libraries, rather than copying only the EXE. For repeatable project settings, cx_Freeze also supports pyproject.toml and a Python setup script.
Check the result before sharing it
Run the application on a Windows machine representative of your recipients' setup. For this example, check the item prices, the $40.00 total, and the Enter prompt. A machine without a separate Python installation is a useful check that you included the runtime and dependencies.
For a larger app, exercise the action a recipient actually needs, such as selecting an input file and saving a report. If a console window closes immediately, launch the EXE from PowerShell to read the error. If an image or template is missing, check both the packaged files and the path used to load them. Dynamic imports may need explicit inclusion with the local packager's options.
Unsigned EXEs from any of these tools can trigger a Microsoft Defender SmartScreen warning the first time someone opens them. The recipient selects More info, then Run anyway.
Frequently asked questions
How do I convert a .py file to an .exe without installing a packager?
Use the Runcell Python to EXE converter (opens in a new tab). Choose your Python file, folder, or ZIP, select the entry script, review dependencies, and build the Windows EXE through your browser.
Can a browser really generate a Windows executable?
Yes. Runcell assembles precompiled Windows components, a Python runtime, and your application into an EXE in the browser. You download that file and run it on Windows. The browser does not need to execute the Windows application to generate its binary.
Does the person running the EXE need Python installed?
No separate Python installation is needed when you distribute the application with its runtime and required dependencies. Runcell includes the runtime in its packaging workflow. For a folder build with a local tool, share the complete output folder.
What is the PyInstaller command for a single EXE?
Run python -m PyInstaller --onefile receipt.py in the Windows environment where PyInstaller and your project's dependencies are installed. The example output is dist\receipt.exe.
Sources and testing
The Runcell workflow and packaging mechanism follow its public product guide (opens in a new tab), checked on November 4, 2026. The local build commands follow the official documentation linked in each method. We ran the receipt source example on macOS, selected it in the live Runcell converter, generated and downloaded receipt.exe, and inspected its Windows x64 PE header. On macOS we also built the receipt script with PyInstaller 6.22.3 (--onefile) and cx_Freeze 8.7.4 to check those commands, and checked Nuitka's mode options against its help output. No EXE was run on Windows for this article.
Related Guides
- How to run Python scripts
- Python virtual environments
- Python pathlib for file and resource paths
- Python argparse for command-line inputs