Skip to main content
SysAdmin Shell Scripting Essentials

Check Python Version on Windows: CMD, PowerShell, py Launcher

check python version windows is the CLI task of querying the installed Python interpreter version using commands like python --version or python -V on Windows CMD or PowerShell.

python --version
python -V
python3 --version
py --list
powershell -Command "python --version"

Options and Flags

Flag Type Description
--version Flag Prints the Python version string and exits.
-V Flag Shorthand for --version. Identical output.
-VV Flag Verbose version: includes build number, compiler, and platform info.
py --list Launcher Lists all installed Python versions managed by the Python launcher for Windows.
py -0 Launcher Lists available versions in a compact format (one per line).

Usage Examples

1. Rapid version check in CMD

C:Usersadmin> python --version
Python 3.12.2

This confirms the default interpreter version. The command returns exit code 0 on success.

2. Using the Python Launcher to see all installations

C:Usersadmin> py --list
 -3.12-64 *
 -3.10-32

The launcher (py.exe) scans the registry for all Python installations. The asterisk marks the default.

See also  PowerShell Array Syntax and Troubleshooting Reference

3. Check version inside a PowerShell script

$ver = & python --version 2>&1
Write-Output "Python version: $ver"

Capture both stdout and stderr. Using 2>&1 ensures the version string is captured even if output goes to stderr.

Troubleshooting & Common Errors

Error Message Root Cause Resolution Command
'python' is not recognized as an internal or external command Python not installed or not in PATH Reinstall Python and check “Add Python to PATH”. Alternatively use py --version (launcher is in System32, always in PATH).
Python was not found; run without arguments to install from the Microsoft Store Python executables missing; Windows 10+ store shortcut confuses CMD Disable App Execution Alias for Python in Settings → Apps → App execution aliases, or install Python from python.org.
python3: command not found (in PowerShell) Linux/Mac alias used on Windows Use python instead of python3 on Windows. If multiple versions exist, use py -3.12 to specify.
Access denied when running py launcher UAC restriction or corrupt launcher Run CMD as Administrator or repair Python installation via “Modify” in Programs & Features.

Multi-Platform Command Equivalents

Platform Command Notes
Windows (CMD) python --version Works if Python is in PATH. Also py --version uses launcher.
PowerShell python --version Same command; optionally Get-Command python | Select-Object Version.
Linux (bash) python3 --version Often python points to Python 2; use python3 explicitly.
macOS (Terminal) python3 --version Apple removed Python 2; install via Homebrew for Python 3.

No native cloud CLI subcommand; Python runtime selection is done via function configuration (AWS Lambda, Azure Functions) or container base images.

Frequently Asked Questions

When should I use the py launcher instead of python on Windows?

Answer: Use py when multiple Python versions are installed.

The launcher reads the shebang line from scripts and respects py.ini. Common usage for version checks:

C:> py --list
 -3.12-64 *
 -3.11-64
C:> py -3.11 --version
Python 3.11.5

How do I fix “‘python’ is not recognized as an internal or external command” on Windows?

Answer: Add Python to the system PATH environment variable.

Manually update PATH via System Properties > Environment Variables. Typical paths: C:Python312 or %USERPROFILE%AppDataLocalProgramsPythonPython312. Verify after fixing:

C:> python --version
Python 3.12.0

Does python --version work on all Windows Server editions, including Windows Server Core and Nano Server?

Answer: Yes, on any Windows edition where Python is installed with console support.

Windows Server Core provides full PowerShell and legacy console. Nano Server lacks full Windows GUI but still runs command-line tools. Test with:

PS C:> python --version
Python 3.12.0

What is the fastest way to check Python version on Windows from PowerShell?

Answer: Run python –version or py –version directly.

Direct execution avoids overhead. Alternative: (Get-Command python).Version but slower. Fastest one-liner:

PS C:> (python --version) -replace 'Python '
3.12.0