-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_py.bat
More file actions
39 lines (29 loc) · 788 Bytes
/
check_py.bat
File metadata and controls
39 lines (29 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('where python 2^>nul') do (
echo %%i | findstr /i "WindowsApps" >nul
if errorlevel 1 (
set PYTHON_EXE=%%i
goto found_python
)
)
echo Real Python not found.
for /f "delims=" %%i in ('where python 2^>nul') do (
echo %%i | findstr /i "WindowsApps" >nul
if errorlevel 1 (
set PYTHON_EXE=%%i
goto found_python
)
)
echo Failed to locate Python executable. Exiting.
exit /b 1
:found_python
echo Found Python at: %PYTHON_EXE%
%PYTHON_EXE% -m pip --version >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo pip not found.
) ELSE (
echo pip is installed.
)
echo Python and pip are ready.
%PYTHON_EXE% -m pip install requests