feat: start.bat支持--no-venv跳过虚拟环境使用系统Python

This commit is contained in:
qinglong
2026-06-14 18:28:49 +08:00
parent 316986c420
commit 40a1502f8b
+16 -3
View File
@@ -11,9 +11,22 @@ echo.
set PASS=0 set PASS=0
set FAIL=0 set FAIL=0
:: ── Python (venv) ── :: ── 检查 --no-venv 参数 ──
set PYTHON=%~dp0.venv\Scripts\python.exe set NO_VENV=0
if not exist "%PYTHON%" (echo [FAIL] .venv 未创建,请先运行: python -m venv .venv ^&^& .venv\Scripts\pip install -r requirements.txt & pause & exit /b 1) echo %* | findstr /i "\-\-no-venv" >nul && set NO_VENV=1
:: ── Python ──
if %NO_VENV% equ 1 (
set PYTHON=python
echo [INFO] --no-venv: 使用系统 Python
) else (
set PYTHON=%~dp0.venv\Scripts\python.exe
if not exist "%PYTHON%" (
echo [FAIL] .venv 未创建,请先运行: python -m venv .venv ^&^& .venv\Scripts\pip install -r requirements.txt
echo 或使用: start.bat --no-venv 跳过虚拟环境
pause & exit /b 1
)
)
"%PYTHON%" --version >nul 2>&1 "%PYTHON%" --version >nul 2>&1
if %errorlevel% equ 0 ( if %errorlevel% equ 0 (
echo [OK] Python echo [OK] Python