-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_py.bat
More file actions
33 lines (26 loc) · 881 Bytes
/
install_py.bat
File metadata and controls
33 lines (26 loc) · 881 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
@echo off
setlocal enabledelayedexpansion
echo Installing Python...
powershell -Command "Invoke-WebRequest -Uri https://www.python.org/ftp/python/3.12.2/python-3.12.2-amd64.exe -OutFile %temp%\python_installer.exe"
%temp%\python_installer.exe /quiet InstallAllUsers=1 PrependPath=1 Include_pip=1
timeout /t 10 /nobreak >nul
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. Installing pip...
%PYTHON_EXE% -m ensurepip --upgrade
) ELSE (
echo pip is installed.
)
%PYTHON_EXE% -m pip install requests
PAUSE