forked from valleyofdoom/AutoGpuAffinity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRUN.bat
60 lines (53 loc) · 1.62 KB
/
RUN.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
@echo off
REM Create a virtual environment if it doesn't exist
if not exist venv (
echo Creating virtual environment...
python -m venv venv
) else (
echo Virtual environment already exists.
)
REM Activate the virtual environment
call venv\Scripts\activate
REM Check if pip needs to be updated
echo Checking pip version...
pip --version > current_pip_version.txt
for /f "tokens=2 delims= " %%a in (current_pip_version.txt) do set current_pip=%%a
del current_pip_version.txt
REM Get the latest pip version
echo Getting latest pip version...
for /f "tokens=*" %%b in ('python -m pip search pip') do (
echo %%b | find "pip (latest)" > nul
if not errorlevel 1 (
set latest_pip=%%b
)
)
REM Compare the versions and update pip if necessary
echo Current pip version: %current_pip%
echo Latest pip version: %latest_pip%
if "%current_pip%" NEQ "%latest_pip%" (
echo Updating pip...
python -m pip install --upgrade pip
) else (
echo Pip is already up-to-date.
)
REM Check if dependencies need to be installed
if exist requirements.txt (
echo Checking installed dependencies...
pip freeze > installed_packages.txt
fc /b requirements.txt installed_packages.txt > nul
if errorlevel 1 (
echo Installing dependencies from requirements.txt...
pip install -r requirements.txt
) else (
echo All dependencies are already installed.
)
del installed_packages.txt
) else (
echo requirements.txt file not found.
)
REM Change console color to green
@echo off
color a
REM Run main.py
echo Running main.py...
py main.py