This guide explains how to create a standalone executable file that doesn't require Python to be installed on the target machine.
- Run the build script:
build_exe.bat
- Wait for completion (may take 2-5 minutes)
- Find your executable at:
dist\MediaManager.exe
-
Install PyInstaller:
pip install pyinstaller==6.3.0 -
Build the executable:
pyinstaller media_manager_gui.spec
-
Find your executable at:
dist\MediaManager.exe
After building, you can distribute:
dist\MediaManager.exe- The main executable (around 15-25 MB)example_config.json- Example configuration (optional)GUI_README.md- User documentation (optional)
- Windows 7 or later
- No Python installation required
- No additional dependencies needed
- Double-click
MediaManager.exe - First run may take 10-15 seconds (extracting bundled files)
- Subsequent runs will be faster
The executable will create configuration files in the same directory:
media_manager_config.json- Settings filelists\- Default output directory (auto-created)
"Python is not installed or not in PATH"
- Install Python 3.6+ from python.org
- Make sure to check "Add Python to PATH" during installation
"pip is not recognized"
- Reinstall Python with pip included
- Or install pip manually
"Build failed with import errors"
- Make sure all source files are in the same directory
- Try:
pip install --upgrade pyinstaller
"Missing modules"
- The spec file includes all required tkinter modules
- If you get import errors, add missing modules to
hiddenimportsin the spec file
"The application failed to start"
- Try running from command prompt to see error messages:
MediaManager.exe
"Antivirus blocking the executable"
- Some antivirus software flags PyInstaller executables as suspicious
- Add an exception for the executable in your antivirus settings
- This is a common false positive with PyInstaller
"Application starts slowly"
- First run extracts files to temp directory (normal)
- Subsequent runs should be faster
- Consider using
--onedirinstead of--onefilefor faster startup
"Configuration not saving"
- Make sure the executable has write permissions in its directory
- Run as administrator if needed
- Check that the directory isn't read-only
- Create or find a
.icofile - Edit
media_manager_gui.spec:icon='path/to/your/icon.ico'
- Rebuild the executable
Edit media_manager_gui.spec and change:
upx=True # Compress the executable (slower startup)Or exclude unused modules:
excludes=['module1', 'module2']Instead of a single .exe file, you can create a folder distribution:
-
Edit
media_manager_gui.spec:exe = EXE( # ... other parameters ... onefile=False, # Add this line )
-
Rebuild - This creates a
dist\MediaManager\folder with:MediaManager.exe- Main executable- Multiple
.dllfiles - Required libraries
This starts faster but requires distributing the entire folder.
Typical sizes for the built executable:
- Single file (.exe): 15-25 MB
- Folder distribution: 20-30 MB (multiple files)
The executable includes:
- Python interpreter
- Tkinter GUI library
- All required standard library modules
- Your application code
For professional distribution, consider code signing:
- Purchase a code signing certificate
- Sign the executable using Windows SDK tools
- This prevents antivirus false positives and Windows SmartScreen warnings
Before distributing:
- Scan the executable with multiple antivirus engines
- Upload to VirusTotal.com to check for false positives
- Consider submitting to antivirus vendors if flagged incorrectly
You can automate builds using GitHub Actions or similar:
# Example GitHub Actions workflow
- name: Build executable
run: |
pip install pyinstaller==6.3.0
pyinstaller media_manager_gui.specTo add version info to the executable:
- Create a version file (
.rcfile) - Reference it in the spec file:
version_file='version.rc'
This adds properties visible in Windows file explorer.