python --version: Check the Active Interpreter
Confirm which Python a CI step is actually running.
python --version prints the interpreter version. Verifying it at the top of a job catches the wrong-Python class of CI failures before they waste a whole run.
What it does
Prints the running interpreter’s version (e.g. "Python 3.11.9"). -V is the short form; -VV prints additional build information.
Common usage
Terminal
python --version
python -V
python -VV
python3.11 --versionCommon CI use: assert the version
When a matrix builds against several Pythons, confirm the active one matches expectations before installing, so a setup misfire fails loudly instead of silently using the wrong interpreter.
Terminal
python --version
python -c "import sys; assert sys.version_info[:2] == (3, 11), sys.version"Related guides
python -m pip: Run pip for the Right InterpreterWhy python -m pip is safer than a bare pip in CI, how it guarantees you install into the intended interpreter…
python -m venv: Create Virtual EnvironmentsHow python -m venv creates an isolated virtual environment, how to activate it on Linux and Windows runners,…
python -c: Run a One-Liner in CIHow python -c runs a snippet of Python directly from the command line, common CI uses like version and import…