Reputation: 3856
I have a local virtualenv (venv) that was activated.
My script executes another script using subprocess.call()
, but that causes the new script to be executed outside of the virtualenv.
Is there any way to execute another process but keep it inside the virtualenv?
EDIT: I don't it's a duplicate of the given links since I assume it is possible to avoid reactivating the virtualenv, and can somehow "stay within it"
Upvotes: 1
Views: 424
Reputation: 3856
I found it possible to use
subprocess.call([sys.executable, "some_script.py", "--param1"])
Upvotes: 3
Reputation: 855
In the bin folder of your virtualenv you can find a file named activate_this.py. You can use it to activate the virtualenv for the current interpreter. Documentation is inside the file.
Upvotes: 0