# Fix pyenv PATH permanently by adding to user environment $PyenvShims = "F:\pyenv\pyenv-win\pyenv-win\shims" $PyenvBin = "F:\pyenv\pyenv-win\pyenv-win\bin" $PyenvRoot = "F:\pyenv\pyenv-win\pyenv-win" # Get current user PATH $CurrentUserPath = [System.Environment]::GetEnvironmentVariable("Path", "User") # Check if paths already exist $pathsToAdd = @($PyenvShims, $PyenvBin, $PyenvRoot) $existingPaths = $CurrentUserPath -split ';' $newPathsToAdd = @() foreach ($path in $pathsToAdd) { if ($path -notin $existingPaths) { $newPathsToAdd += $path Write-Host "Adding $path to PATH" -ForegroundColor Green } else { Write-Host "$path already in PATH" -ForegroundColor Yellow } } if ($newPathsToAdd.Count -gt 0) { # Prepend new paths to existing PATH $NewUserPath = ($newPathsToAdd + $existingPaths) -join ';' # Set new user PATH [System.Environment]::SetEnvironmentVariable("Path", $NewUserPath, "User") Write-Host "`nPATH has been updated successfully!" -ForegroundColor Green Write-Host "Please restart your terminal or session to apply changes." -ForegroundColor Yellow } else { Write-Host "No changes needed - all paths already configured" -ForegroundColor Cyan } # Also update current session $env:Path = ($newPathsToAdd + $existingPaths) -join ';' + ";" + $env:Path Write-Host "`nCurrent session PATH updated (temporary)" -ForegroundColor Cyan