create_venv.py 376 B

12345678910111213141516171819
  1. import venv
  2. import pathlib
  3. import os
  4. import subprocess
  5. import sys
  6. venv.create(env_dir=pathlib.Path().absolute(),with_pip=True)
  7. path = pathlib.Path("requirement.txt")
  8. if path.is_file() :
  9. subprocess.check_call([sys.executable, "-m", "pip", "install", "-r","requirement.txt"])
  10. else :
  11. raise ("requirement.txt doesn't exist in script folder !!")