@echo off chcp 65001 >nul echo ======================================== echo 开始打包 factory_sliceing 为 Windows EXE echo ======================================== echo. REM 检查 Python 是否安装 python --version >nul 2>&1 if errorlevel 1 ( echo [错误] 未找到 Python,请先安装 Python pause exit /b 1 ) echo [1/4] 检查并安装依赖包... python -m pip install --upgrade pip python -m pip install redis>=4.0.0 oss2>=2.17.0 requests>=2.28.0 pyinstaller>=5.0.0 if errorlevel 1 ( echo [错误] 依赖包安装失败 pause exit /b 1 ) echo. echo [2/4] 清理之前的构建文件... if exist build rmdir /s /q build if exist dist rmdir /s /q dist if exist __pycache__ rmdir /s /q __pycache__ for /d /r . %%d in (__pycache__) do @if exist "%%d" rmdir /s /q "%%d" echo. echo [3/4] 使用 PyInstaller 打包... pyinstaller build_exe.spec --clean --noconfirm if errorlevel 1 ( echo [错误] 打包失败 pause exit /b 1 ) echo. echo [4/4] 打包完成! echo. echo ======================================== echo 打包结果: echo ======================================== echo EXE 文件位置: dist\factory_sliceing.exe echo. echo 使用说明: echo 1. 将 dist\factory_sliceing.exe 复制到目标 Windows 机器 echo 2. 在命令行中运行: factory_sliceing.exe --work-dir D:\work echo. echo ======================================== pause