Button guide
Python to exe in 2026 PyInstaller steps, the 4 problems you will hit, and a no-exe option for coworkers
To convert a Python script to an exe, run pip install pyinstaller and then pyinstaller --onefile script.py on a Windows machine; your executable will be waiting in the dist folder. If you are only doing this so a coworker can run your script without installing Python, you can skip the .exe build altogether with Button (https://button.bitgate.dev), which turns the script on your own computer into a web form for $0 on the Free plan (1 published tool, 3 people, 100 runs per month) or $15/month on Pro.
How to build an exe with PyInstaller
PyInstaller bundles a Python program and its dependencies into an executable or a folder, and its license (GPLv2+ with an exception) lets you distribute what you build, including commercial programs.
Here is how you build a single .exe file:
- Open your terminal or command prompt inside the environment where your script already runs, and install PyInstaller:
pip install pyinstaller
- Run PyInstaller on your entry-point script with the
--onefileflag so everything gets packed into one file instead of a directory:
pyinstaller --onefile script.py
Look in the new
distfolder that PyInstaller creates in your project directory. Insidedist, you will findscript.exe, which is the file you send to your coworker (you can ignore thebuildfolder and the.specfile next to it for a basic build).If your script uses a GUI and you don't want a black console window popping up behind it on Windows, add
--windowed:
pyinstaller --onefile --windowed script.py
- If your program needs non-code data files bundled inside the executable, pass
--add-datawhen you build:
pyinstaller --onefile --add-data "template.xlsx;." script.py
At run time, a --onefile program finds bundled files under sys._MEIPASS, the temporary folder it unpacks to, rather than next to the .exe.
The 4 problems you will hit with PyInstaller
Building the .exe on your own machine takes a minute or two. Getting it onto a colleague's computer and keeping it working is where the headaches start.
First, antivirus false positives are a known PyInstaller issue (the project has a dedicated issue template for them). You send the .exe over, and an antivirus tool may quarantine it before your coworker even opens it.
Second, PyInstaller is not a cross-compiler: you build the Windows exe on Windows and the macOS app on a Mac. If you work on a Mac or Linux box and your coworker is on Windows, you can't just build their .exe from your laptop. And if you also have a colleague on macOS, unsigned apps from an unidentified developer trigger a Gatekeeper warning; signing requires the Apple Developer Program at $99 per year.
Third, --onefile builds unpack into a temporary _MEI folder every time the program starts.
Fourth, you have to re-send the .exe after every change. Every time you fix a bug or tweak a column name in the script, you are rebuilding the executable and sending a new file to everyone who uses it, hoping nobody keeps running the old one left in their Downloads folder.
When PyInstaller is the better choice, and when to use Button
PyInstaller is the better choice when you are shipping a desktop application to people outside your team, when the person running the script needs it to work offline, or when it needs to run even while your own computer is turned off. It is also the right call if the script handles files larger than 25 MB each or needs more than 30 minutes to finish.
If you just want a couple of coworkers to run a script you already have working on your machine, Button (https://button.bitgate.dev) lets you skip the .exe completely. Button turns a script on your own computer into a web form your colleagues can run. Any program works: Python, Node, R, PowerShell, shell scripts, compiled binaries.
Jobs run on the creator's computer, never in Button's cloud, while Button's servers relay the form values and files between the browser and that computer. Because it runs right on your machine in your existing Python environment, you don't bundle dependencies, you don't cross-compile for Windows, and you never deal with antivirus warnings on a coworker's PC.
The runner only executes the exact command the creator approved on that computer (pinned by hash). Every form value is passed to the program as its own argument, with no shell, and a value can't start with "-". If you change a tool, people have to confirm the new version before running it, every run is logged with who ran it and when, and access can be revoked or set to expire at any time.
How to share a Python script with coworkers using Button
Before you set up Button, prep your script so it doesn't rely on hard-coded file paths or interactive input() prompts:
- Make the script take its inputs as command-line arguments using
argparsein Python (orcommandArgs()in R, aparam()block in PowerShell,$1and$2in bash). Take each input file path as an argument, and write the results as files into an output folder that is also passed as an argument.
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("--input-file", required=True)
parser.add_argument("--currency", required=True)
parser.add_argument("--output-dir", required=True)
args = parser.parse_args()
out_path = os.path.join(args.output_dir, "result.csv")
with open(args.input_file, "r") as src, open(out_path, "w") as dst:
dst.write(f"Currency: {args.currency}\n")
dst.write(src.read())
- Sign in at button.bitgate.dev.
- Install the Button runner on your computer (macOS, Linux or Windows) with the one-line command the site shows you (curl on macOS and Linux, PowerShell on Windows).
- Pick the program in a local setup page, and describe its inputs (text, number, yes/no, choice, files). Fixed flags such as
--currencyare part of the command you approve; colleagues only supply the values for the form fields. - Publish the tool. Button gives the tool its own page.
- Invite your colleagues. They open the link from their invite email, sign in with Google or a one-time email code, fill in the form, press Run and download the results. They install nothing and never pay.
While you use it, keep Button's limits and pricing in mind:
| Limit | Free | Pro |
|---|---|---|
| Price | $0 | $15/month, or $144/year |
| Published tools | 1 | 50 |
| People you invite (you don't count) | 3 | 250 |
| Runs per month (including yours) | 100 | 5,000 |
| File transfer per month | 1 GB | 50 GB |
| Per run, on both plans | 30 minutes; up to 8 files, 25 MB each, 100 MB total | 30 minutes; up to 8 files, 25 MB each, 100 MB total |
Because jobs run on your machine, your computer has to be on and online when a coworker needs the tool (tool pages show Ready, Busy or Offline), and it handles one run at a time. Logs are capped at 1 MB per run, inputs are deleted 24 hours after a run and outputs after 7 days. Recipients never pay, and downgrading deletes nothing.
FAQ
Can I build a Windows exe from a Mac with PyInstaller?
No, PyInstaller is not a cross-compiler, so you have to build a Windows exe on Windows and a macOS app on a Mac. If you use Button instead, the Python script stays and runs on your Mac while your Windows coworkers run it from their browser.
Why does Windows flag my PyInstaller exe as a virus?
Antivirus false positives are a known PyInstaller issue, to the point that the project has a dedicated issue template for them. Because Button runs the script on your own computer and coworkers just use a web form in their browser, there is no .exe file to get blocked on their machine.
Where does the Python script actually run when a coworker uses Button?
Jobs run on your own computer, never in Button's cloud, while Button's servers relay the form values and files between the browser and your computer. Your computer has to be on and online for colleagues to run the tool, and its page will show Ready, Busy or Offline.
What happens when I update my Python script in Button?
You don't rebuild or re-send anything, because the script runs on your computer. If you change the tool itself, such as its command or form, your coworkers confirm the new version before their next run.
How much does Button cost for the coworkers who run my tool?
Recipients never pay and install nothing. For you as the creator, Free is $0 for 1 published tool, 3 invited people and 100 runs per month, and Pro is $15/month (or $144/year) for 50 tools, 250 people and 5,000 runs per month.
Last updated
Put your script behind a form
Button turns a script on your computer into a web form. Colleagues sign in, fill it in, press Run and download the results. Free for 1 tool and 3 people.