-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrun_project_setup.bat
50 lines (40 loc) · 1.52 KB
/
run_project_setup.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
@echo off
REM Function to find the correct Python binary
setlocal enabledelayedexpansion
set "required_version=3.9"
set "max_version=4.0"
for /f "tokens=*" %%I in ('where python*.exe') do (
for /f "tokens=*" %%J in ('%%I -c "import sys; print('.'.join(map(str, sys.version_info[:3])))"') do (
set "python_version=%%J"
for /f "tokens=1,2 delims=." %%K in ("!python_version!") do (
if %%K GEQ 3 (
if %%K LEQ 3 (
if %%L GEQ 9 (
if %%L LEQ 11 (
if "!python_version!" LSS "!max_version!" (
set "PYTHON=%%I"
goto :found_python
)
)
)
)
)
)
)
)
echo You must have a Python version higher than 3.9 and lower than 4.0 to launch this project.
exit /b 1
:found_python
echo Using Python binary: %PYTHON%
REM Display the platform machine
for /f "tokens=*" %%I in ('%PYTHON% -c "import platform; print(platform.machine())"') do (
set "platform_machine=%%I"
)
echo Platform machine: %platform_machine%
REM Create a virtual environment
%PYTHON% -m venv eflp_venv
REM Activate the virtual environment
call eflp_venv\Scripts\activate.bat
REM Install dependencies for the project using the pip associated with the virtual environment
eflp_venv\Scripts\pip install -r requirements.txt
echo The project has been successfully installed. Perform the following README steps.