I am trying to create and activate a virtual environment from a Python script. However I keep getting the following error:
FileNotFoundError: [Errno 2] No such file or directory: 'source'
I have tried, following different suggestions from past questions on this page:
from subprocess import run
run(["python", "-m", "venv", "venvIA"])
run(["source", "venvIA/bin/activate"])
How can I correctly activate the virtual environment from my script? I also tried replacing "source"
for .
and other tricks I found online.
I am currently using Visual Studio code on a MacOS device but I am also planning on doing another similar code for Windows systems later, in case you know how to work with those too.
source https://stackoverflow.com/questions/77251123/activation-of-venv-from-script-not-working
Comments
Post a Comment