-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_python.bat
More file actions
66 lines (52 loc) · 1.5 KB
/
Copy pathinstall_python.bat
File metadata and controls
66 lines (52 loc) · 1.5 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
54
55
56
57
58
59
60
61
62
63
64
65
66
@echo off
setlocal enabledelayedexpansion
:: Python Installer Script
:: Author: Recep Karayigit
:: Version: 1.1
set PYTHON_VERSION=3.12.0
set PYTHON_INSTALLER=python-%PYTHON_VERSION%-amd64.exe
set PYTHON_URL=https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER%
echo ==================================================
echo Python Installer Script
echo Version: %PYTHON_VERSION%
echo ==================================================
echo.
:: Check if Python is already installed
echo Checking Python installation...
python --version >nul 2>nul
IF %ERRORLEVEL% EQU 0 (
echo Python is already installed.
python --version
goto END
)
echo Python not found. Downloading installer...
echo.
:: Try curl first, fallback to PowerShell if not available
where curl >nul 2>nul
IF %ERRORLEVEL% EQU 0 (
curl -o %PYTHON_INSTALLER% %PYTHON_URL%
) ELSE (
powershell -Command "Invoke-WebRequest -Uri %PYTHON_URL% -OutFile '%PYTHON_INSTALLER%'"
)
IF NOT EXIST %PYTHON_INSTALLER% (
echo Failed to download Python installer.
goto END
)
echo Installing Python silently...
%PYTHON_INSTALLER% /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
echo Waiting for installation to complete...
timeout /t 25 >nul
echo Cleaning up installer...
del %PYTHON_INSTALLER%
:: Verify installation
echo.
python --version >nul 2>nul
IF %ERRORLEVEL% EQU 0 (
echo Python installed successfully!
python --version
) ELSE (
echo Installation may have failed. Please check manually.
)
:END
echo.
pause