From aeb6ccb6655c27ae644bae0b148f2ef78d24ba9b Mon Sep 17 00:00:00 2001 From: yshtcn Date: Sun, 23 Jul 2023 13:41:22 +0800 Subject: [PATCH] Update Auto-installer-package.bat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加自动检查pip和py是否正确安装的功能 --- Auto-installer-package.bat | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Auto-installer-package.bat b/Auto-installer-package.bat index 7536afc..541fa4d 100644 --- a/Auto-installer-package.bat +++ b/Auto-installer-package.bat @@ -1,4 +1,31 @@ @echo off +setlocal enabledelayedexpansion + +:: 检查pip +for /f "tokens=1" %%i in ('pip --version 2^>^&1 ^| findstr /C:"pip"') do ( + set PIPVER=%%i +) +if "!PIPVER!" == "pip" ( + echo Pip detected! +) else ( + echo Error: pip is not installed. + pause + exit /b 1 +) + +:: 检查python +for /f "tokens=1" %%h in ('python --version 2^>^&1') do ( + set PYVER2=%%h +) +if "!PYVER2!" == "Python" ( + echo Python detected! +) else ( + echo Error: Python is not installed. + pause + exit /b 1 +) +endlocal + pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pystray pillow requests configparser PySocks @echo 安装完成 pause