From c04b3b6b5d8109494c93740efbfb9921f0c8d55b Mon Sep 17 00:00:00 2001 From: haoslm <6083297@qq.com> Date: Thu, 30 Jul 2026 12:36:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=8D=E5=8A=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 服务管理.bat | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/服务管理.bat b/服务管理.bat index 82b5a1f..6a67b8d 100644 --- a/服务管理.bat +++ b/服务管理.bat @@ -27,14 +27,18 @@ if not exist "%NSSM_EXE%" ( ) REM 检查虚拟环境 +set "PYTHON_PATH=" if exist ".venv\Scripts\python.exe" ( - set PYTHON_PATH=%cd%\.venv\Scripts\python.exe + set "PYTHON_PATH=%cd%\.venv\Scripts\python.exe" ) else ( - for /f "delims=" %%i in ('where python') do ( - set PYTHON_PATH=%%i - goto :found_python + for /f "delims=" %%i in ('where python 2^>nul') do ( + if not defined PYTHON_PATH set "PYTHON_PATH=%%i" + ) + if not defined PYTHON_PATH ( + echo [错误] 未找到 Python,请先安装 Python 或创建虚拟环境 + pause + exit /b 1 ) - :found_python ) echo ========================================