-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_env.py
More file actions
24 lines (19 loc) · 875 Bytes
/
run_env.py
File metadata and controls
24 lines (19 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import subprocess, os, sys, platform
def venv_exists():
return os.path.exists("venv")
def create_venv():
print("🔧 Creating virtual environment...")
subprocess.check_call([sys.executable, "-m", "venv", "venv"])
def install_requirements():
print("📦 Installing dependencies...")
pip_exec = os.path.join("venv", "Scripts" if platform.system() == "Windows" else "bin", "pip")
subprocess.check_call([pip_exec, "install", "-r", "requirements.txt"])
def run_script():
print("🚀 Running JSON Generator in virtual environment...")
python_exec = os.path.join("venv", "Scripts" if platform.system() == "Windows" else "bin", "python")
subprocess.check_call([python_exec, "JsonGenerator.py"])
if __name__ == "__main__":
if not venv_exists():
create_venv()
install_requirements()
run_script()