Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

How to Check Your Python Version

Updated November 30, 2026 · Written and reviewed under our editorial policy

To check your Python version, open a terminal and run python3 --version on Mac or Linux, or py --version on Windows. Python prints a line like "Python 3.x.y". Inside a script, import sys and print sys.version. Use python3 -VV for build details.

  • Open Terminal (Mac/Linux) or Command Prompt (Windows).
  • Run python3 --version (Windows: py --version).
  • Read the "Python 3.x.y" line.
  • To list every Python on Windows, run py --list.

Source: Python documentation, "Command line and environment" and "Using Python on Windows", checked 2026-11-28.

Check your Python version on Windows

On Windows, check your Python version with the py launcher that the python.org installer adds. Open Command Prompt or PowerShell and run:

py --version
py --list

py --version prints the version the launcher runs by default. py --list (short form py -0) lists every Python the launcher can find and marks the default with an asterisk (*). python --version also works, but only when Python is on your PATH; if Windows says python is not recognized, use py instead. When python and py report different versions, two installs are on the computer and python is whichever comes first on PATH.

Once the version checks out, run your Python script with the same command name.

Selenium and Playwright both have Python minimums. Once your version checks out, run your Python tests on TestMu AI's cloud grid and test Python apps on 3,000+ browsers with TestMu AI (formerly LambdaTest).

Windows Command Prompt showing py --version and py --list output

Check your Python version on Mac and Linux

On Mac and Linux, check your Python version with python3 --version in Terminal. Use python3, not python: current macOS has no python command, and on many Linux systems python is missing, or on older systems points to Python 2. Run the command in Terminal.app or any of the Mac terminals we tested.

python3 --version
python3 -VV
which -a python3

python3 -VV adds build details such as the compiler. which -a python3 lists every python3 on your PATH in the order the shell searches them, and the first one is the one python3 runs. More than one line usually means more than one install, for example Apple's, python.org's and Homebrew's. No python3 at all? See how to install Python on Mac.

Check the Python version inside a script

Inside a script, check the Python version with the sys module. sys.version is the full version string, and sys.version_info holds the parts as numbers, which is what you compare against when your code needs a minimum version:

import sys

print(sys.version)
print(sys.version_info)

if sys.version_info < (3, 10):
    sys.exit("This script needs Python 3.10 or newer.")

Replace (3, 10) with the minimum your code needs. Compare sys.version_info with a tuple rather than comparing version strings, because as text "3.9" sorts after "3.10". If you only want the number as a string, platform.python_version() returns it. Save the code to a file and run a Python script as usual to see the output.

Check the Python version in VS Code and Jupyter

VS Code shows the Python version it uses in the status bar at the bottom of the window whenever a Python file is open. Click it, or open the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on Mac) and run Python: Select Interpreter, to see every interpreter VS Code found and switch to another one.

In a Jupyter notebook, run !python --version in a cell. The ! sends the command to the shell, so it reports the python on the shell's PATH, which isn't always the Python behind the notebook's kernel. For the kernel's own version, run import sys; print(sys.version) in a cell. Other editors show the interpreter elsewhere; see our picks for Python IDEs.

Check the Python version in a virtual environment

In a virtual environment, check the Python version after you activate it, because activation puts the environment's own python first on PATH:

# Mac and Linux
source .venv/bin/activate
python --version

# Windows (Command Prompt)
.venv\Scripts\activate
python --version

# Windows (PowerShell)
.venv\Scripts\Activate.ps1
python --version

A virtual environment always uses the Python version it was created with. To move a project to another version, create a new environment with that Python and reinstall the packages. On a Mac you can install Python on Mac from python.org or Homebrew and build the environment from it. New environments include pip by default; if a system Python has none, see how to install pip.

Check pip and package versions

Check the pip version with python3 -m pip --version (Windows: py -m pip --version). The output also names the Python that pip belongs to, so it confirms which install your packages go into.

python3 -m pip --version
python3 -m pip show requests
python3 -m pip list

pip show <package> prints one package's version, location and dependencies, and pip list prints every installed package with its version. Run them through python3 -m pip so they report on the same Python you checked above. If python3 -m pip --version fails, install pip with ensurepip.

Working with Java as well? You can check your Java version with our online tool.

Frequently Asked Questions

How do I check my Python version on Windows?

Open Command Prompt or PowerShell and run py --version. To see every Python installed on the computer, run py --list.

Why do python and python3 show different versions?

You have two Python installs, and each command points to a different one. The shell runs the first match it finds on PATH; which -a python3 on Mac or Linux, or py --list on Windows, shows what is installed.

How do I check the Python version in a script?

Import sys and print sys.version. To require a minimum version, compare sys.version_info with a tuple, for example sys.version_info >= (3, 10).

How do I check which Python VS Code uses?

Open a Python file and look at the interpreter shown in the status bar. Click it, or run Python: Select Interpreter from the Command Palette, to see and change it.

How do I check my pip version?

Run python3 -m pip --version (Windows: py -m pip --version). The output shows pip's version and the Python it belongs to.

Related Questions

Test Your Website on 3000+ Browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests