Build a binary version of Python code¶
123
Step 1: Install PyInstaller¶
On your local machine, run:
Step 2: Build the Binary¶
Assuming your main entry point is src/main.py, from your repo root run:
This will create a single binary called
Step 3: Test the Binary¶
Go to dist/ and run the binary to ensure it works.
Step 4: Add Binary to GitHub (Best Practice)¶
You should not commit binaries directly to your repo! Instead, binaries should go in GitHub Releases so your repo stays clean and versioned.
A. Add a Release¶
Push your code changes (if you haven’t already):
- Go to your repo on GitHub
- Click "Releases" > "Create a new release"
- Fill in the release info:
- Tag version (e.g. v1.1.0)
- Title (e.g. "Binary Release v1.1.0")
- Description: explain what’s new.
- Upload your binary
- Drag the dist/
.exe (Windows)
- Drag the dist/
- Publish the release.
B. Add Build Instructions to README¶
Add a section to your README.md explaining how to build the binary, e.g.: