101 lines
2.8 KiB
Markdown
101 lines
2.8 KiB
Markdown
# Important Note About Building Windows Executables
|
|
|
|
## ⚠️ Cross-Platform Building Limitation
|
|
|
|
**PyInstaller creates platform-specific executables.** This means:
|
|
|
|
- ❌ You **CANNOT** build a Windows `.exe` from Linux/Raspberry Pi
|
|
- ✅ You **MUST** build on Windows to create a Windows executable
|
|
- ✅ You **CAN** build on Linux to create a Linux executable
|
|
|
|
## Solution: Build on Windows
|
|
|
|
### Option 1: Use a Windows Machine
|
|
1. Copy all project files to a Windows computer
|
|
2. Install Python 3.8+ on Windows
|
|
3. Run the build:
|
|
```cmd
|
|
python -m venv venv
|
|
venv\Scripts\activate
|
|
pip install -r requirements.txt
|
|
python build_windows.py
|
|
```
|
|
|
|
### Option 2: Use a Windows Virtual Machine
|
|
1. Install VirtualBox or VMware
|
|
2. Create a Windows VM
|
|
3. Follow the same steps as Option 1
|
|
|
|
### Option 3: Use Wine (Advanced, Not Recommended)
|
|
Wine can sometimes work but is unreliable for Kivy applications.
|
|
|
|
## What You CAN Do on Raspberry Pi/Linux
|
|
|
|
### 1. Build Linux Executable
|
|
```bash
|
|
source venv/bin/activate
|
|
pip install pyinstaller
|
|
pyinstaller --onefile --windowed main.py
|
|
```
|
|
This creates: `dist/main` (Linux executable)
|
|
|
|
### 2. Run Directly with Python (Recommended for Development)
|
|
```bash
|
|
source venv/bin/activate
|
|
python main.py
|
|
```
|
|
|
|
### 3. Transfer Files to Windows for Building
|
|
Use:
|
|
- USB drive
|
|
- Network share
|
|
- Git repository
|
|
- Cloud storage (Dropbox, Google Drive, etc.)
|
|
|
|
## Recommended Workflow
|
|
|
|
**For Distribution:**
|
|
1. Develop on Raspberry Pi/Linux (as you're doing now)
|
|
2. When ready to distribute, transfer project to Windows
|
|
3. Build Windows executable on Windows machine
|
|
4. Distribute the `.exe` file to end users
|
|
|
|
**For Testing:**
|
|
- Keep developing and testing with `python main.py` on your Raspberry Pi
|
|
- The app works perfectly without building an executable
|
|
|
|
## Alternative: Distribute as Python App
|
|
|
|
Instead of an executable, you can distribute:
|
|
|
|
1. **Python files + instructions**
|
|
```
|
|
- Give users: main.py, database_manager.py, requirements.txt
|
|
- Users install Python and run: pip install -r requirements.txt && python main.py
|
|
```
|
|
|
|
2. **Docker container** (works on any platform)
|
|
```bash
|
|
docker build -t database-app .
|
|
docker run database-app
|
|
```
|
|
|
|
## Files Ready for Windows Build
|
|
|
|
✅ All necessary files are ready:
|
|
- `build_windows.py` - Automated build script
|
|
- `build.bat` - Windows batch file
|
|
- `DatabaseApp.spec` - PyInstaller configuration
|
|
- `BUILD_WINDOWS_GUIDE.md` - Complete instructions
|
|
- `main.py` - Main application
|
|
- `database_manager.py` - Database logic
|
|
- `requirements.txt` - Dependencies
|
|
|
|
**Just transfer these files to Windows and run `build.bat`**
|
|
|
|
## Questions?
|
|
|
|
- The app works perfectly as-is with Python on any platform
|
|
- Building executables is only needed for distribution to users without Python
|
|
- For personal use or development, keep using `python main.py`
|