Skip to content Skip to footer

Python & Environment Variable Checker

Here’s a script! To run it on Windows:

If you get a security warning, open PowerShell and run:

       Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

    Then try again.

    The script will:

    🐍 Highlight any Python-related env vars

    
    # ============================================
    # Python & Environment Variable Checker
    # Run this in PowerShell as Administrator
    # ============================================
    
    Write-Host "`n========================================" -ForegroundColor Cyan
    Write-Host "  PYTHON VERSION CHECK" -ForegroundColor Cyan
    Write-Host "========================================" -ForegroundColor Cyan
    
    # Check all Python versions available
    $pythonLocations = @()
    
    try {
        $pyVersions = py --list 2>&1
        Write-Host "`nInstalled Python versions (via py launcher):" -ForegroundColor Yellow
        Write-Host $pyVersions
    } catch {
        Write-Host "Python launcher (py) not found." -ForegroundColor Red
    }
    
    # Check if Python 3.13 specifically is available
    Write-Host "`n--- Python 3.13 Specific Check ---" -ForegroundColor Yellow
    try {
        $py313 = py -3.13 --version 2>&1
        if ($py313 -match "3.13") {
            Write-Host "βœ… Python 3.13 IS installed: $py313" -ForegroundColor Green
        } else {
            Write-Host "❌ Python 3.13 is NOT installed." -ForegroundColor Red
        }
    } catch {
        Write-Host "❌ Python 3.13 is NOT installed." -ForegroundColor Red
    }
    
    # Check default python
    Write-Host "`n--- Default Python ---" -ForegroundColor Yellow
    try {
        $defaultPy = python --version 2>&1
        $defaultPath = (Get-Command python -ErrorAction SilentlyContinue).Source
        Write-Host "Default: $defaultPy" -ForegroundColor White
        Write-Host "Path:    $defaultPath" -ForegroundColor White
    } catch {
        Write-Host "No default python found in PATH." -ForegroundColor Red
    }
    
    # Find all python.exe on the system
    Write-Host "`n--- All Python Executables Found ---" -ForegroundColor Yellow
    $searchPaths = @(
        "C:\Python*",
        "C:\Users\$env:USERNAME\AppData\Local\Programs\Python\*",
        "C:\Program Files\Python*",
        "C:\Program Files (x86)\Python*"
    )
    $found = $false
    foreach ($path in $searchPaths) {
        $exes = Get-ChildItem -Path $path -Filter "python.exe" -ErrorAction SilentlyContinue
        foreach ($exe in $exes) {
            $ver = & $exe.FullName --version 2>&1
            Write-Host "  $ver  ->  $($exe.FullName)" -ForegroundColor White
            $found = $true
        }
    }
    if (-not $found) {
        Write-Host "  No python.exe found in common locations." -ForegroundColor DarkGray
    }
    
    Write-Host "`n========================================" -ForegroundColor Cyan
    Write-Host "  ENVIRONMENT VARIABLES" -ForegroundColor Cyan
    Write-Host "========================================" -ForegroundColor Cyan
    
    # PATH variable (formatted nicely)
    Write-Host "`n--- PATH entries ---" -ForegroundColor Yellow
    $env:PATH -split ";" | Where-Object { $_ -ne "" } | ForEach-Object {
        Write-Host "  $_" -ForegroundColor White
    }
    
    # Python-related env vars
    Write-Host "`n--- Python-related Variables ---" -ForegroundColor Yellow
    $pyVars = Get-ChildItem Env: | Where-Object { $_.Name -match "PYTHON|PY" }
    if ($pyVars) {
        $pyVars | ForEach-Object { Write-Host "  $($_.Name) = $($_.Value)" -ForegroundColor White }
    } else {
        Write-Host "  No PYTHON* environment variables found." -ForegroundColor DarkGray
    }
    
    # All System + User env vars
    Write-Host "`n--- All Environment Variables ---" -ForegroundColor Yellow
    Get-ChildItem Env: | Sort-Object Name | ForEach-Object {
        Write-Host "  $($_.Name) = $($_.Value)" -ForegroundColor White
    }
    
    Write-Host "`n========================================" -ForegroundColor Cyan
    Write-Host "  Done! Press any key to exit." -ForegroundColor Cyan
    Write-Host "========================================`n" -ForegroundColor Cyan
    Read-Host "Press Enter to close"

    βœ… Check if Python 3.13 is installed (and show all installed Python versions)

    πŸ“ Show the exact file path of each Python install

    πŸ—‚οΈ List all environment variables including your full PATH

    Leave a comment