le-yolo/run_app.bat

62 lines
1.3 KiB
Batchfile
Raw Permalink 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
:: 创建虚拟环境并且运行app.py的脚本 (Windows版本)
echo 开始设置YOLO项目环境...
:: 检查Python是否安装
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo 错误: Python 未安装请先安装Python
pause
exit /b 1
)
:: 创建虚拟环境
echo 创建虚拟环境...
python -m venv venv
if %errorlevel% neq 0 (
echo 创建虚拟环境失败
pause
exit /b 1
)
:: 激活虚拟环境
echo 激活虚拟环境...
call venv\Scripts\activate.bat
:: 升级pip
echo 升级pip...
python -m pip install --upgrade pip
:: 安装依赖
echo 安装项目依赖...
pip install -r requirements.txt
if %errorlevel% neq 0 (
echo 安装依赖失败
pause
exit /b 1
)
:: 检查测试视频文件是否存在
if not exist "res\test.mp4" (
echo ❌ 错误: res\test.mp4 文件不存在!
echo.
echo 请按以下步骤操作:
echo 1. 在 res\ 目录中放置一个视频文件
echo 2. 将视频文件重命名为 test.mp4
echo 3. 重新运行此脚本
echo.
echo 支持的视频格式: .mp4, .avi, .mov, .mkv 等
echo 脚本已停止运行。
pause
exit /b 1
)
:: 运行应用
echo 运行应用...
cd src
python app.py
echo ✅ 应用运行完成!检测结果已保存在 runs\detect\ 目录中
pause