-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallReqs.bat
More file actions
53 lines (47 loc) · 1.43 KB
/
Copy pathinstallReqs.bat
File metadata and controls
53 lines (47 loc) · 1.43 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@echo off
:: Detect OS and architecture
set "DOWNLOAD_URL="
if defined ProgramFiles(x86) (
set "DOWNLOAD_URL=https://www.python.org/ftp/python/3.12.8/python-3.12.8-amd64.exe"
) else (
set "DOWNLOAD_URL=https://www.python.org/ftp/python/3.12.8/python-3.12.8.exe"
)
:: ARM detection
wmic os get osarchitecture | find "ARM" >nul
if %ERRORLEVEL% EQU 0 (
set "DOWNLOAD_URL=https://www.python.org/ftp/python/3.12.8/python-3.12.8-arm64.exe"
)
if not defined DOWNLOAD_URL (
echo Unsupported OS or detection failure. Please visit https://www.python.org/downloads/
pause
exit /b
)
:: Check if Python is installed
python --version >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo Downloading Python installer...
powershell -Command "Invoke-WebRequest -Uri %DOWNLOAD_URL% -OutFile python-installer.exe"
if %ERRORLEVEL% NEQ 0 (
echo Failed to download Python installer.
pause
exit /b
)
echo Installing Python...
start /wait python-installer.exe /quiet InstallAllUsers=1 PrependPath=1
if %ERRORLEVEL% NEQ 0 (
echo Failed to install Python.
pause
exit /b
)
del python-installer.exe
)
:: Check pip installation
python -m pip --version >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
python -m ensurepip --upgrade
python -m pip install --upgrade pip
)
:: Install tkinter
pip install tk
echo Python, pip, and tkinter are ready.
pause