Last Updated : 23 Jul, 2025
Python has multiple versions, and it's important to know which version is installed on your system. This information is crucial because different Python versions may have variations in syntax or libraries, and ensuring you're using the correct version is vital for compatibility with your projects. In this guide, we'll explore various straightforward methods on how to check the Python version on your Linux, Windows, and Mac systems.
How to Check Python Version on Windows and MacTo check the Python version on Windows or Mac system, we can follow these methods:
Open the Command Prompt for Windows by searching for "cmd" in the Windows Start menu or open Terminal for Mac by searching Terminal in the MacOS spotlight search. Then, use one of the following commands:
For Python 2:
python --version
or
python -V
For Python 3:
python Version using Command Prompt Using Interactive Shellpython3 --version
or
python3 -V
We can also find the Python version in the interactive shell. Open the Command Prompt/terminal and enter one of the following commands:
For Python 2:
python
For Python 3:
python3
Once you are in the Python interactive shell, you can check the version with these Python commands:
Python Version Using Interactive Shell How to Check Python Version on Linuximport sys
print(sys.version)
We can use the following methods to check the Python version on Linux systems like Ubuntu, Debian, Arch, etc. These methods can be used to find Python version:
The command line provides a straightforward way to get the Python version. Open your terminal and use this simple check Python version command:
For Python 2:
python --version
or
python -V
For Python 3:
Check Python Version Using the Command Linepython3 --version
or
python -V
Check Python Version Using Interactive ShellNOTE: These commands will display the Python version installed on your Linux system.
Python's interactive shell is another way to find Python version. Open your terminal and enter one of the following commands:
For Python 2:
python
For Python 3:
python3
Once you are in the Python interactive shell, you can get Python version with the following Python commands:
Checking Python Version in the Interactive Shell Check Python Version Using Package Managersimport sys
print(sys.version)
If you installed Python using a package manager, you can use these tools to check the Python version.
For Debian-based systems, such as Ubuntu, you can use `apt`:
Check Python Version Using Package Managersapt show python3
For Red Hat-based systems, like CentOS, you can use yum:
yum info python3
NOTE: These commands will provide detailed information about the Python version installed on your system.
Finding Python Version by Checking the PathWe can also determine the path to the Python interpreter and indirectly obtain information about the installed version using the `which` command:
which python3
This command will return the path to the Python interpreter. We can then use this path to check the version:
/path/to/python --version
Replace '/path/to/python' with the actual path obtained from the previous which command.
Finding Python Version by Checking the PathAlso Read:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4