-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
setup_env.bat
executable file
·48 lines (43 loc) · 1.12 KB
/
setup_env.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
@echo off
REM Get the directory path of the script
set "dirpath=%~dp0"
if "%dirpath:~-1%" == "\" set "dirpath=%dirpath:~0,-1%"
REM Check if git is installed
git --version > nul 2>&1
if %errorlevel% NEQ 0 (
echo:
echo No git executable found in PATH!
echo:
pause
exit /b 1
)
REM Create the virtual environment if it doesn't exist
if not exist "%dirpath%\env" (
echo:
echo Creating the env folder...
python -m venv "%dirpath%\env"
if %errorlevel% NEQ 0 (
echo:
echo No python executable found in PATH or failed to create virtual environment!
echo:
pause
exit /b 1
)
)
REM Activate the virtual environment and install requirements
echo:
echo Installing requirements.txt...
"%dirpath%\env\scripts\python" -m pip install -U pip
"%dirpath%\env\scripts\pip" install wheel
"%dirpath%\env\scripts\pip" install -r "%dirpath%\requirements.txt"
if %errorlevel% NEQ 0 (
echo:
echo Failed to install requirements.
echo:
pause
exit /b 1
)
echo:
echo Environment setup completed successfully.
echo:
pause