I would like to write a python script that does 3 things :
- build a virtual environment with python3
- activate this new virtual env. ( bash: source myvirtenv/bin/acticate)
- install packages with a requirements.txt (bash: pip install -r )
In my project I use the normal virtualenviroment package . and I have to do it on a Debian machine.
I tried to mimic the bash command with os.system()
but didn't make it with the code below.
import os
os.system('python3 -m venv test6_env')
os.system('source test6_env/bin/activate')
os.system('pip install -r requirements.txt --user')
Problem the virtualenv will not activated and the requirements not installed.
Is there a easy trick to script in python this 3 stepy nicely ?