---Advertisement---

How to Check Python Version on Linux, Mac & Windows The Ultimate Guide for All Operating Systems Don’t Miss It 2025

By Bhavani

Updated On:

---Advertisement---
How to Check Python Version

👉How to Check Python Version

👉Introduction

How to Check Python Version: Checking your Python version is essential for ensuring compatibility with libraries and frameworks. Whether you are a beginner or an experienced developer, this guide will help you verify your Python version across different operating systems such as Windows, Mac, and Linux.

👉How to Check Python Version Using Commands

Here are some quick commands to check your Python version in various environments:

👉Command Line Commands

How to Check Python Version

CommandPlatformOutput Example
python –versionWindows/Mac/LinuxPython 3.10.7
python3 –versionWindows/Mac/LinuxPython 3.10.7
python -vWindows/Mac/LinuxDetailed version information
python -VVLinuxFull version details

👉How to Check Python Version Using Python Script

Python scripts can also determine the Python version installed on your system. Use these sample codes:

👉Using sys Module

import sys

print(sys.version)

Output: 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]

👉Using platform Module

import platform

print(platform.python_version())

Output: 3.10.7

👉Using python_version()

from platform import python_version

print(“Current Python Version -“, python_version())

Output: Current Python Version – 3.8.10

👉How to Check Python Version on Windows

👉Steps to Check Python Version in Command Prompt

  1. Open Command Prompt by typing cmd in the Windows search bar.
  2. Type the following command:

python –version

Output: Python 3.10.7

👉Steps to Check Python Version in PowerShell

  1. Open PowerShell by typing “PowerShell” in the Start menu.
  2. Run the following command:

python3 –version

Output: Python 3.10.7

👉How to Check Python Version on Mac

👉Steps to Check Python Version in Mac Terminal

  1. Open the Terminal by typing “Terminal” in the search box.
  2. Type the following command:

python3 –version

Output: Python 3.3.1

Alternatively, to check Python 2, use:

python –version

Output: Python 2.7.4

👉How to Check Python Version on Linux

👉Steps to Check Python Version in Linux Terminal

  1. Open the Terminal.
  2. Type the following command:

python3 –version

Output: Python 3.5.2

To check Python 2 version:

python –version

Output: Python 2.7.12

👉Checking Multiple Python Versions Installed

If multiple Python versions are installed, you can differentiate them as follows:

  • To Check Python 2: python –version
  • To Check Python 3: python3 –version

👉Key Differences Between Python 2 and Python 3

  • Python 3 uses Unicode for string storage by default, whereas Python 2 requires adding a u before string literals.
  • Python 2 is no longer maintained; therefore, Python 3 is recommended for modern development.

Python Escape Characters

Download Python

Leave a Comment

Index