On Windows (11), I'm trying to activate a python virtualenv inside a subprocess.run
, but, I'm not able to execute the activate script :
import subprocess
p = subprocess.run(".\venv\Scripts\activate.bat", shell=True, stderr=subprocess.PIPE)
print(p.stderr)
Produce :
b"'.' n'est pas reconnu en tant que commande interne\r\nou externe, un programme ex\x82cutable ou un fichier de commandes.\r\n"
Note: .\venv\Scripts\activate.bat
is working in a shell prompt.
How am I supposed to activate a virtual env inside a subprocess.run
?