Python Windows Detection Scripts - Which Python Utilities
Ready-to-use Python scripts to detect which Python installation you're using on Windows systems with version and path information.
Python Windows Detection Scripts - Which Python Utilities
These utility scripts help you determine which Python installation you're currently using on Windows, including version details, installation paths, and system configuration.
Basic Python Detection Script #
Simple Version Checker #
🐍 Try it yourself
Advanced Python Environment Scanner #
Complete System Analysis #
🐍 Try it yourself
Python Launcher Detection #
Windows Python Launcher (py.exe) Scanner #
import subprocess
import sys
import os
def detect_py_launcher():
"""Detect available Python versions via py.exe launcher"""
print("=== Python Launcher Detection ===\n")
try:
# List all available Python versions
result = subprocess.run(['py', '-0'],
capture_output=True, text=True, shell=True)
if result.returncode == 0:
print("Available Python versions:")
for line in result.stdout.strip().split('\n'):
if line.strip():
print(f" {line}")
else:
print("Python Launcher (py.exe) not available")
# Show default version
result = subprocess.run(['py', '--version'],
capture_output=True, text=True, shell=True)
if result.returncode == 0:
print(f"\nDefault version: {result.stdout.strip()}")
except FileNotFoundError:
print("Python Launcher (py.exe) not found")
print("Install from python.org to get the launcher")
# Run the detection
detect_py_launcher()
Registry-Based Python Detection #
Windows Registry Scanner #
🐍 Try it yourself
Environment Comparison Tool #
Multi-Version Comparison Script #
🐍 Try it yourself
Quick Python Checker #
One-Line Detection Commands #
# Quick commands to check which Python on Windows
# Method 1: Basic version check
import sys; print(f"Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} at {sys.executable}")
# Method 2: Installation type detection
import sys; print("Microsoft Store" if "windowsapps" in sys.executable.lower() else "Official/Custom")
# Method 3: Virtual environment check
import sys, os; print(f"Venv: {os.path.basename(os.environ.get('VIRTUAL_ENV', 'None'))}")
# Method 4: Architecture check
import platform; print(f"{platform.python_version()} ({platform.architecture()[0]})")
Usage Examples #
Save Detection Results #
🐍 Try it yourself
Summary #
These which Python Windows detection scripts help you:
- Identify your current Python installation type and location
- Compare multiple Python versions on your system
- Verify environment variables and PATH configuration
- Detect virtual environment status
- Export Python configuration for troubleshooting
Use these utilities to quickly determine which Python installation you're working with on Windows systems.