-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
start.py
35 lines (29 loc) · 1 KB
/
start.py
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
import subprocess
import sys
import os
import venv
def check_python():
try:
subprocess.run(['python', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
except subprocess.CalledProcessError:
print("Python is not installed. Please install Python and try again.")
sys.exit(1)
def create_venv():
if not os.path.exists('venv'):
print("Creating virtual environment...")
venv.create('venv', with_pip=True)
else:
print("Virtual environment already exists.")
def install_dependencies():
print("Installing dependencies...")
subprocess.run(['venv\\Scripts\\activate.bat', '&&', 'pip', 'install', '-r', 'requirements.txt'], shell=True, check=True)
def start_main():
print("Starting main.py...")
subprocess.run(['venv\\Scripts\\activate.bat', '&&', 'python', 'src\\main.py'], shell=True, check=True)
def main():
check_python()
create_venv()
install_dependencies()
start_main()
if __name__ == "__main__":
main()