-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathprepare-virtual-environment-WINDOWS.bat
48 lines (40 loc) · 1.48 KB
/
prepare-virtual-environment-WINDOWS.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 =======================================
REM Batch script to set up Python environment for urbs
REM =======================================
REM Check if the virtual environment exists
if exist "urbs-env\Scripts\activate" (
echo Virtual environment already exists.
) else (
REM Create the virtual environment
echo Creating virtual environment...
py -3.12 -m venv urbs-env
REM Check if creation was successful
if not exist "urbs-env\Scripts\activate" (
echo Error: Failed to create virtual environment.
exit /b 1
)
)
REM Activate the virtual environment (Windows)
call urbs-env\Scripts\activate
echo Virtual environment has been activated.
REM Check if packages are already installed
REM Using a dummy file to detect if packages are installed, you can also use pip freeze or similar checks
if exist "urbs-env\installed.flag" (
echo Required packages already installed.
) else (
echo Installing required packages from urbs-env.txt...
python -m pip install -r urbs-env.txt
REM Check if the installation succeeded
if %errorlevel% neq 0 (
echo Error: Failed to install packages.
exit /b 1
)
REM Create a flag to indicate that packages have been installed
echo Packages installed successfully > urbs-env\installed.flag
echo Packages installed successfully.
)
REM Notify the user that the process is complete
echo Your urbs environment is ready to use.
REM Prevent the script from closing immediately
pause