Find your Python version from the command line

The fastest way to check your Python version is to open your terminal or command prompt and run a single command. Python itself will tell you the version number, the build date, and which compiler was used to create it.

On Windows, open Command Prompt. On Mac or Linux, open Terminal. Then type this exactly:

python --version

Press Enter. Python will print something like Python 3.11.5 or Python 3.9.2. That number is your version.

If that command does not work, try python3 --version instead. On some machines, especially Macs and Linux systems, python points to an older version and python3 points to the current one. Both commands do the same thing — they just check different installations.

Key Takeaways

  • Run python --version or python3 --version in your terminal to see your Python version instantly.
  • If one command does not work, try the other — Windows usually responds to python, while Mac and Linux often need python3.
  • You can also check the version from inside a Python script using the sys module, which is useful if you are writing code that needs to know what version it is running on.
  • The version number tells you which features are available — Python 3.10 and later have different syntax than Python 3.9, so knowing your version matters when you copy code from tutorials.

Check your version from inside a Python script

If you are already writing Python code, you can check the version without leaving your script. This is useful when you want your program to know what version it is running on, or when you need to test whether a feature exists before you use it.

Open your Python file or interactive shell and type:

import sys print(sys.version)

This prints the full version string, including the build information. If you only want the version number without the extra details, use:

import sys print(sys.version_info)

This prints a tuple like sys.version_info(major=3, minor=11, micro=5, releaselevel='final', serial=0). You can pull out just the major and minor version numbers this way:

import sys print(f"{sys.version_info.major}.{sys.version_info.minor}")

Understand what the version numbers mean

Python version numbers follow a pattern: major.minor.micro. When you see 3.11.5, that breaks down as major version 3, minor version 11, and micro version 5.

The major version (the first number) changes rarely and marks a big shift in how Python works. Python 2 and Python 3 are so different that code written for one often will not run on the other. Most new code should use Python 3.

The minor version (the middle number) increments when Python gets new features. Python 3.10 introduced match statements, which do not exist in Python 3.9. Python 3.12 added better error messages. If you are copying code from a tutorial, check whether it requires a newer minor version than you have.

The micro version (the last number) is a patch release that fixes bugs without adding features. Python 3.11.4 and Python 3.11.5 work almost identically — the difference is just security fixes or stability improvements. You do not usually need to worry about matching the micro version exactly.

Check the version when Python is not in your PATH

Sometimes Python is installed on your computer but the terminal cannot find it because it is not in your system PATH — the list of folders your computer searches when you type a command. This happens most often on Windows or when you installed Python in an unusual location.

On Windows, try the Microsoft Store version first. Open Command Prompt and type python. If the Microsoft Store opens instead of showing a version number, Python is installed through the Store. Click Install, and then the command will work.

If that does not work, search your computer for python.exe. On Windows, use File Explorer to search your C: drive. On Mac, open Terminal and type find /usr -name python3. Once you find the full path, you can run it directly. For example, on Windows you might type C:\Users\YourName\AppData\Local\Programs\Python\Python311\python.exe --version.

The easier fix is to reinstall Python and make sure you check the box that says "Add Python to PATH" during setup. Then restart your terminal and try the command again.

Check versions when you have multiple Python installations

Some computers have more than one Python version installed. You might have Python 3.9 and Python 3.11 side by side, or you might have one installed globally and another inside a virtual environment. Knowing which one you are actually using matters.

To see the full path to the Python that your terminal is using, run:

which python (on Mac or Linux) where python (on Windows)

This shows you exactly which Python executable the terminal found. If you have multiple versions and want to use a specific one, you can call it by its full path or by its version number. For example, python3.11 --version runs Python 3.11 specifically, while python3.9 --version runs Python 3.9.

If you are using a virtual environment, activate it first. The virtual environment usually points to a specific Python version, and activating it makes sure you are checking the right one. Once activated, python --version will show you the version that virtual environment uses.

Verify your version matches what your project needs

Before you start a new Python project, check whether the code or libraries you want to use require a specific version. Many Python libraries list their version requirements in their documentation or in a file called requirements.txt.

If a library says it needs Python 3.10 or later and you have Python 3.9, that library will not install. You will see an error message when you try. The fix is either to upgrade Python or to find a different library that supports your version.

You can also check the Python version your project is currently set to use. If you are using a virtual environment, the version is locked to whatever was installed when you created it. If you are using a tool like pyenv or conda, those tools let you switch between versions easily. For a simple project, just check python --version in the project folder and compare it to what the project documentation says it needs.

Frequently Asked Questions

Why do I get "python is not recognized" when I type the command?

Python is either not installed or not in your system PATH. Try python3 --version instead — on some systems, only the python3 command works. If that also fails, reinstall Python from python.org and check the box that says "Add Python to PATH" during installation. Restart your terminal after reinstalling.

What is the difference between python and python3?

On older systems, python points to Python 2, which is no longer supported. python3 points to Python 3, the current version. Most modern machines have only Python 3 installed, so both commands work the same way. If you have both versions installed, use python3 to make sure you get the current one.

Can I have two different Python versions on the same computer?

Yes. You can install multiple versions and call them by their specific names — python3.9, python3.11, and so on. Virtual environments also let you use different versions for different projects. Use which python3.9 or where python3.9 to see which version you are calling.

Do I need to update Python if I have an older version?

It depends on what you are building. Older Python versions still work, but they do not get security updates forever. Python 3.8 and earlier are no longer officially supported. If you are starting a new project, use the latest version. If you have an existing project that works, you only need to update if you want to use newer features or if a library you need requires a newer version.