import venv import pathlib import os import subprocess import sys venv.create(env_dir=pathlib.Path().absolute(),with_pip=True) path = pathlib.Path("requirement.txt") if path.is_file() : subprocess.check_call([sys.executable, "-m", "pip", "install", "-r","requirement.txt"]) else : raise ("requirement.txt doesn't exist in script folder !!")