From 856d22b7abb2973aed65c51b67e19794820e433c Mon Sep 17 00:00:00 2001 From: Benjamin Auquite Date: Sat, 24 Feb 2024 07:23:44 -0600 Subject: [PATCH] don't activate an already activated venv --- install_python_venv.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install_python_venv.ps1 b/install_python_venv.ps1 index fc0fdd4ab..323352441 100644 --- a/install_python_venv.ps1 +++ b/install_python_venv.ps1 @@ -583,6 +583,11 @@ $findVenvExecutable = $true if (Get-ChildItem Env:VIRTUAL_ENV -ErrorAction SilentlyContinue) { # Check if a venv is already activated $venvPath = $env:VIRTUAL_ENV Write-Host "A virtual environment is currently activated: $venvPath" + if ($null -ne $pythonExePath) { # check if this script itself was previously used to activate this venv. + Write-Host "install_python_venv.ps1 has already ran and activated this venv, nothing left to do by rerunning this." + return + } + deactivate } elseif ($venvPath -ne ($repoRootPath + $pathSep) -and (Test-Path $venvPath -ErrorAction SilentlyContinue)) { Write-Host "Found existing python virtual environment at '$venvPath'" } else {