Python is one of the most popular programming languages, widely used for automation, web development, data science, and artificial intelligence. Before running Python scripts or installing libraries, it’s crucial to check Python version on your system to ensure compatibility.
Different operating systems have different ways to verify the installed Python version. This guide will walk you through how to check Python version on Windows, Mac, and Linux using various methods.

How to Check Python Version on Windows
1. Using Command Prompt (CMD)
The quickest way to check Python version on Windows is through the Command Prompt.
Steps to check Python version using CMD:
- Press
Win + R
, typecmd
, and pressEnter
to open the Command Prompt. - Type the following command and press
Enter
:
python –version
Or
python -V
The installed Python version will be displayed on the screen.
If you have Python 3 installed, but the above command doesn’t work, try:
python3 –version
2. Using PowerShell
Windows PowerShell is another tool to check Python version.
Steps to check Python version using PowerShell:
- Press
Win + X
, then select Windows Terminal (PowerShell). - Type the following command and press
Enter
:
python –version
- The Python version will be displayed instantly.
3. Using a Python Script
You can also use a Python script to check Python version programmatically.
Steps to check Python version using a script:
- Open Notepad or any text editor.
- Write the following Python code:
import sys
print(“Python Version:”, sys.version)
Save the file as check_version.py
.Open CMD or PowerShell, navigate to the file location, and run:
python check_version.py
- The output will display your Python version.

How to Check Python Version on Mac
1. Using Terminal
Mac users can quickly check version using the Terminal.
Steps to check Python version on Mac:
- Press
Command + Space
, type Terminal, and hitEnter
. - Type the following command and press
Enter
:
python3 –version
The installed Python version will be displayed.
Note: On older Mac versions, Python 2 may still be available. To check Python 2, use:
python –version
2. Using a Python Script
You can also use a Python script to check Python version on Mac.
Steps to check version using a script:
- Open a text editor and write the following code:
import platform
print(“Python Version:”, platform.python_version())
Save the file as check_version.py
.
Open Terminal, navigate to the file location, and run:
python3 check_version.py
- The script will output your Python version.

How to Check Version on Linux
1. Using Terminal
Most Linux distributions come with Python pre-installed. To check version, use the Terminal.
Steps to check version on Linux:
- Open Terminal (
Ctrl + Alt + T
). - Type one of the following commands and press
Enter
:
python3 –version
or
python –version
- The installed Python version will be displayed.
2. Checking the Installed Python Packages
You can get more details about your Python installation using a command.
Steps to check full version details:
- Open Terminal.
- Run the following command:
python3 -c “import sys; print(sys.version)”
This command will display the Python version along with additional details.
How to Check If Multiple Python Versions Are Installed
If you have multiple versions of Python installed, you can check them using the following commands:
- On Windows:
where python
On Mac/Linux:
which python
List all installed Python versions (Windows only):
py -0
This will help you identify which Python version is set as default.
How to Update Python to the Latest Version
If you find that your Python version is outdated, you can update it easily.
Updating Python on Windows
- Go to the official Python website: https://www.python.org/downloads/.
- Download the latest version for Windows.
- Run the installer and select Upgrade Now to update Python.
Updating Python on Mac
- Open Terminal.
- Use Homebrew to update Python:
brew install python
Verify the update:
python3 –version
Updating Python on Linux
- Open Terminal.
- Use the package manager for your distribution:
- Ubuntu/Debian:
sudo apt update && sudo apt install python3
Fedora
sudo dnf install python3
Arch Linux:
sudo pacman -S python
Common Issues and Troubleshooting
Sometimes, checking the Python version may result in errors. Here are common issues and how to fix them:
- Python not recognized as a command:
- Ensure Python is added to the system’s environment variables (Windows).
- Use
python3
instead ofpython
on Mac/Linux.
- Multiple Python versions conflicting:
- Use
which python
orwhere python
to check installed versions. - Set the default Python version using alias commands in
.bashrc
or.zshrc
.
- Use
- Command not found:
- Reinstall Python and ensure it’s properly configured.
Conclusion
Knowing how to check version is essential for debugging, installing libraries, and ensuring compatibility with projects. Whether you’re using Windows, Mac, or Linux, there are multiple ways to verify your installed Python version. Keeping Python updated will help you stay secure and take advantage of the latest features.
If you found this guide helpful, share it with others and keep exploring the power of Python! 🚀