feat: start.bat支持--no-venv跳过虚拟环境使用系统Python
This commit is contained in:
@@ -11,9 +11,22 @@ echo.
|
||||
set PASS=0
|
||||
set FAIL=0
|
||||
|
||||
:: ── Python (venv) ──
|
||||
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 & pause & exit /b 1)
|
||||
:: ── 检查 --no-venv 参数 ──
|
||||
set NO_VENV=0
|
||||
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
|
||||
if %errorlevel% equ 0 (
|
||||
echo [OK] Python
|
||||
|
||||
Reference in New Issue
Block a user