-
Notifications
You must be signed in to change notification settings - Fork 62
/
InstallPythonPrerequisites.bat
76 lines (70 loc) · 1.72 KB
/
InstallPythonPrerequisites.bat
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
67
68
69
70
71
72
73
74
75
76
@echo off
setlocal EnableExtensions
python --version > nul 2>&1
if ERRORLEVEL 1 (
echo Error: Python is not installed
exit /B 1
)
python --version 2>&1 | findstr "2.7" > nul 2>&1
if ERRORLEVEL 1 (
python --version 2>&1 | findstr "3.6" > nul 2>&1
if ERRORLEVEL 1 (
echo Error: Wrong version of Python detected. 2.7.x or 3.6.x required
exit /B 1
)
)
echo Python installed. Checking required modules...
python -c "import pip" > nul 2>&1
if ERRORLEVEL 1 (
echo "Module pip not installed. Using easy_install"
echo | set /p="Testing configparser... "
python -c "import configparser" > nul 2>&1
if ERRORLEVEL 1 (
echo not installed. Installing...
easy_install --user -U configparser
if ERRORLEVEL 1 (
echo Error: Python failed installing configparser
exit /B 1
)
) else (
echo already installed!
)
echo | set /p="Testing pywin32... "
python -c "import win32api" > nul 2>&1
if ERRORLEVEL 1 (
echo not installed. Installing...
easy_install --user -U pywin32
if ERRORLEVEL 1 (
echo Error: Python failed installing pywin32
exit /B 1
)
) else (
echo already installed!
)
) else (
echo | set /p="Testing configparser... "
python -c "import configparser" > nul 2>&1
if ERRORLEVEL 1 (
echo not installed. Installing...
python -m pip install --user -U configparser
if ERRORLEVEL 1 (
echo Error: Python failed installing configparser
exit /B 1
)
) else (
echo already installed!
)
echo | set /p="Testing pywin32... "
python -c "import win32api" > nul 2>&1
if ERRORLEVEL 1 (
echo not installed. Installing...
python -m pip install --user -U pywin32
if ERRORLEVEL 1 (
echo Error: Python failed installing pywin32
exit /B 1
)
) else (
echo already installed!
)
)
echo Setup successful