BodyBalanceEvaluation/backend/build_backend.bat
2025-08-06 09:04:13 +08:00

64 lines
1.4 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001 >nul
echo ================================================
echo 身体平衡评估系统 - 后端打包工具
echo ================================================
echo.
:: 检查是否在正确的目录
if not exist "app.py" (
echo ❌ 错误请在backend目录下运行此脚本
pause
exit /b 1
)
:: 检查Python环境
echo 🔍 检查Python环境...
python --version
if errorlevel 1 (
echo ❌ 错误Python未安装或未添加到PATH
pause
exit /b 1
)
:: 安装打包依赖
echo.
echo 📦 安装打包依赖...
pip install pyinstaller
if errorlevel 1 (
echo ❌ 错误PyInstaller安装失败
pause
exit /b 1
)
:: 清理之前的构建
echo.
echo 🧹 清理之前的构建文件...
if exist "build" rmdir /s /q "build"
if exist "dist" rmdir /s /q "dist"
if exist "*.spec" del /q "*.spec"
echo ✓ 清理完成
:: 运行打包脚本
echo.
echo 🚀 开始打包...
python build_exe.py
if errorlevel 1 (
echo ❌ 打包失败
pause
exit /b 1
)
echo.
echo 🎉 打包完成!
echo.
echo 📁 输出目录dist/
echo 🚀 可执行文件dist/BodyBalanceBackend.exe
echo 📋 启动脚本dist/start_backend.bat
echo.
echo 使用说明:
echo 1. 将整个dist文件夹复制到目标机器
echo 2. 确保目标机器有必要的运行时库Visual C++ Redistributable
echo 3. 运行 BodyBalanceBackend.exe 或 start_backend.bat
echo.
pause