3.2 KiB
3.2 KiB
Building Orisys Sensor Demo Executable and Installer
This guide explains how to package camera_gui.py into a standalone executable (.exe) and create an installer.
Prerequisites
-
Python 3.8+ installed
-
All dependencies installed:
pip install -r requirements.txt pip install PyQt5 pyqtgraph PyInstaller -
For creating installer (.exe installer):
- Download and install Inno Setup (free, open-source)
Method 1: Using PyInstaller (Simple)
Option A: Using the spec file (Recommended)
-
Build the executable:
pyinstaller camera_gui.spec -
The executable will be in the
distfolder:dist\camera_gui.exe
Option B: Using the build script
-
Run the build script:
python build_exe.py -
The executable will be in the
distfolder:dist\camera_gui.exe
Option C: Manual PyInstaller command
pyinstaller --name=camera_gui --onefile --windowed --icon=orisys_logo_notext.png --add-data="orisys_logo_notext.png;." camera_gui.py
Method 2: Creating an Installer (.exe installer)
Using Inno Setup
-
Build the executable first using Method 1 above
-
Open Inno Setup Compiler
-
Open the script file:
build_installer.iss -
Compile the installer:
- Click "Build" → "Compile"
- Or press F9
-
The installer will be created in the
installerfolder:installer\OrisysSensorDemo_Setup.exe
Customizing the Installer
Edit build_installer.iss to customize:
- App name and version
- Installation directory
- Start menu shortcuts
- Desktop icons
- License file
- Additional files to include
Troubleshooting
Common Issues
-
"Module not found" errors:
- Add missing modules to
hiddenimportsincamera_gui.spec - Or use
--hidden-import=module_namein PyInstaller command
- Add missing modules to
-
Large executable size:
- This is normal - PyInstaller bundles Python interpreter and all dependencies
- Consider using
--onedirinstead of--onefilefor faster startup
-
Missing DLL files:
- Ensure Visual C++ Redistributable is installed on target machines
- Include required DLLs using
--add-binaryoption
-
OpenCV/CUDA issues:
- If using CUDA, ensure CUDA DLLs are available
- May need to add CUDA paths to
pathexin spec file
Testing the Executable
- Test on a clean Windows machine (without Python installed)
- Ensure all required DLLs are included
- Test camera functionality
- Test file saving functionality
File Structure
After building, you should have:
dist/
└── camera_gui.exe # Standalone executable
installer/
└── OrisysSensorDemo_Setup.exe # Installer (after compiling with Inno Setup)
Distribution
- Standalone executable: Just distribute
dist\camera_gui.exe - Installer: Distribute
installer\OrisysSensorDemo_Setup.exefor easier installation
Notes
- The executable is large (~100-200MB) because it includes Python interpreter and all dependencies
- First launch may be slower as files are extracted
- Antivirus software may flag PyInstaller executables - this is a false positive
- Consider code signing for production releases