Files
UAV-CO2/build_exe.bat
2026-02-05 15:13:54 +08:00

62 lines
1.5 KiB
Batchfile

@echo off
REM GasFlux Web API - Build executable with PyInstaller
REM This script builds a standalone executable using Waitress WSGI server
echo Building GasFlux Web API executable...
REM Check if PyInstaller is installed
python -c "import PyInstaller" >nul 2>&1
if errorlevel 1 (
echo Error: PyInstaller is not installed. Please run:
echo pip install pyinstaller waitress
pause
exit /b 1
)
REM Check if Waitress is installed
python -c "import waitress" >nul 2>&1
if errorlevel 1 (
echo Error: Waitress is not installed. Please run:
echo pip install waitress
pause
exit /b 1
)
REM Create dist directory if it doesn't exist
if not exist "dist" mkdir dist
echo Creating executable with PyInstaller...
REM Build the executable
pyinstaller --onefile ^
--name GasFluxAPI ^
--hidden-import waitress ^
--hidden-import flask ^
--hidden-import werkzeug ^
--hidden-import yaml ^
--hidden-import pandas ^
--hidden-import numpy ^
--hidden-import flask_cors ^
--hidden-import psutil ^
--add-data "src\gasflux\gasflux_config.yaml;src\gasflux" ^
--add-data "API_DOCUMENTATION.md;." ^
--exclude-module matplotlib ^
--exclude-module tkinter ^
server_waitress.py
if errorlevel 1 (
echo Error: Failed to build executable
pause
exit /b 1
)
echo.
echo Build completed successfully!
echo Executable created: dist\GasFluxAPI.exe
echo.
echo To run the server:
echo GasFluxAPI.exe
echo.
echo The server will start on http://localhost:5000
echo.
pause