The fastest way to check your Python version

Open your terminal or command prompt and type python --version or python3 --version, then press Enter. The output will show you the exact version number installed on your machine. On Windows, use Command Prompt or PowerShell. On Mac or Linux, use Terminal.

If you have both Python 2 and Python 3 installed, you may need to try both commands — python might point to Python 2 (which is no longer supported), while python3 will show you Python 3. Most modern systems use Python 3, so start there.

If the command returns "command not found" or "is not recognized", Python is either not installed or not in your system's PATH. The sections below cover what to do in that situation.

Key Takeaways

  • Type python --version or python3 --version in your terminal to see your Python version instantly.
  • On Windows, use Command Prompt or PowerShell; on Mac or Linux, use Terminal.
  • If the command does not work, Python may not be installed or may not be in your system's PATH.
  • You can also check your version from inside Python itself by importing the sys module and printing sys.version.
  • Different projects may require different Python versions, so knowing which version you have helps you avoid compatibility problems.

Checking Python version on Windows

Open Command Prompt by pressing Windows key + R, typing cmd, and pressing Enter. At the prompt, type python --version and press Enter. You should see output like "Python 3.11.5" or similar.

If that does not work, try python3 --version instead. If neither command works, Python is not installed on your system or is not in your PATH. You can verify this by typing where python — if Python is installed, this will show you the folder where it lives. If you get no result, you need to install Python first.

Alternatively, open PowerShell (right-click the Start button and select Windows PowerShell) and use the same commands. PowerShell and Command Prompt both work the same way for this task.

Checking Python version on Mac

Open Terminal by pressing Command + Space, typing terminal, and pressing Enter. Type python3 --version and press Enter. On modern Macs, python alone may not work because Apple removed Python 2 support, so python3 is the command you need.

If you installed Python using Homebrew (a package manager for Mac), you may have multiple versions installed. Type which python3 to see which one your system is using by default. If you want to see all Python versions on your machine, type ls /usr/local/bin/python*.

Checking Python version on Linux

Open Terminal and type python3 --version. Most Linux distributions come with Python 3 pre-installed, so this command usually works immediately. If you need to check for Python 2 as well (though it is no longer supported), type python2 --version.

If neither command works, Python is not installed. You can install it using your distribution's package manager — for example, sudo apt install python3 on Ubuntu or Debian, or sudo yum install python3 on Red Hat or CentOS.

Checking your version from inside Python

You can also check your Python version while running Python itself. Type python or python3 to start the Python interpreter. You will see the version number displayed at the top of the output, along with build information.

Alternatively, type the following commands at the Python prompt:

import sys print(sys.version)

This will print the full version string, including the build date and compiler information. To exit the Python interpreter, type exit() or press Ctrl + D on Mac/Linux or Ctrl + Z then Enter on Windows.

What to do if Python is not found

If your terminal says "command not found" or "is not recognized as an internal or external command", Python is either not installed or not in your system's PATH (the list of folders your computer searches when you type a command).

First, check whether Python is actually installed by looking in the standard installation folders. On Windows, check C:\Users\YourUsername\AppData\Local\Programs\Python. On Mac, check /usr/local/bin or /opt/homebrew/bin. On Linux, check /usr/bin.

If you find Python in one of these folders but the command still does not work, the folder is not in your PATH. You can add it manually, but the easier solution is to reinstall Python and make sure to check the box that says "Add Python to PATH" during installation (on Windows) or use a package manager like Homebrew (on Mac) or apt (on Linux).

Why knowing your Python version matters

Different Python versions have different features and syntax. Code written for Python 3.11 may not work on Python 3.8, and Python 2 code definitely will not work on Python 3. Before you run someone else's code or install a package, check whether it requires a specific Python version.

Many projects list their Python version requirement in a file called requirements.txt or in their README. If your version is older than what the project needs, you may need to upgrade Python or use a virtual environment to run a different version for that specific project.

Frequently Asked Questions

What is the difference between python and python3?

On systems with both Python 2 and Python 3 installed, python usually points to Python 2 (which stopped being supported in 2020), while python3 points to Python 3. Most modern work uses Python 3, so if you are unsure, use python3 --version.

Can I have multiple Python versions installed at the same time?

Yes. Many developers have Python 3.9, 3.10, and 3.11 all installed on the same machine. You can check which one is the default with python3 --version, and you can run a specific version by typing the full path or using a tool like pyenv to switch between them.

Why does my Python version say it is outdated?

Python releases new versions regularly, and older versions eventually stop receiving security updates. If your version is more than a few years old, consider upgrading. You can download the latest version from python.org, or use a package manager like Homebrew (Mac), apt (Linux), or Chocolatey (Windows).

Do I need to uninstall my old Python version before installing a new one?

Not necessarily. You can have multiple versions installed side by side. However, if you want only one version and want to avoid confusion, uninstalling the old one first is simpler. Just make sure any projects that depend on the old version are updated or moved to a virtual environment first.

What if I need a specific Python version for a project?

Use a virtual environment, which is a folder that contains a specific Python version and its own set of packages separate from your system Python. Tools like venv (built into Python), virtualenv, or pyenv let you create isolated environments for different projects, so each one can use the version it needs.