×

How to check the version of the Python Interpreter?

As we all know what an interpreter is, and how important it is. We should also be aware of the fact that it is important to have knowledge of the version of the Python interpreter we are using, as many functions do not run on older versions, hence it should be up to date to use the latest features of Python smoothly.

Python is widely used in source coding and computer programming in many industries. It executes the interactive commands received by it.

How to check the version of Python?

Some methods used to check the version of Python are:

  • Python -V command
  • Python_version() function
  • sys.version method

Before checking the version of the Python interpreter, it is necessary that your device should have installed it. To check it, execute the following command in the command prompt:

Python

If the terminal shown below appears then you have it installed on your device, and if you see any kind of error then first install Python from its official website.

How to check the version of the Python Interpreter

Method 1: Using the “Python -V” command

It is one of the most commonly used commands to check the version of the Python interpreter. This is an inbuilt Python command.

The following steps are followed to check the version of the Python interpreter:

  1. First, open the command prompt.
  2. Then, execute the following command in it, and after pressing enter you will receive the current version of the Python interpreter:
Python -V

Output:

How to check the version of the Python Interpreter

Method 2: Using the “Python_version()” function:

This is one of the methods to check the version of the Python interpreter. To use this function, the platform library has to be imported. This function can be used in both, the terminal and in IDLE.

The following steps are followed to check the version of the Python interpreter:

  1. First, open the command prompt or the IDLE.
  2. Then, if you opened the command prompt, type Python and press enter.
  3. Finally, at last, execute the following command in the terminal or IDLE:
fromplatform importPython_versionas pv
print("The version of current Python interpreter is:",pv())

Output:

How to check the version of the Python Interpreter

Method 3: Using the “sys.version” method:

It is the last method to check the version of the Python interpreter, of the three we mentioned before. To use this method, the user has to import the sys library. Just like the “Python_version()” function, it can be used in both, the terminal and in IDLE.

The following steps are followed to check the version of the Python interpreter:

  1. First, open the command prompt or the IDLE.
  2. Then, if you opened the command prompt, type Python and press enter.
  3. Finally, at last, execute the following command in the terminal or IDLE:
importsys
print("The version of current Python interpreter is : ",sys.version)

Output:

How to check the version of the Python Interpreter

Note: This method does surely give some additional details along with the version of Python interpreter.


Related Topics

Multiprocessing in python

The word multiprocessing is used to compute the operation in which more than two processors run simultaneously with more than one central processor. The computer's performance increases gradually. Multiprocessing is...

6 minutes read.

Python maketrans() function

Introduction A static method is the string maketrans() one. It is used to make a one-to-one mapping between a string's character and its translation, i.e., to define the list of characters...

5 minutes read.

Python Continue Statement

In Python, loops automate and repeat processes in a cost-effective manner. However, there may be occasions when you wish to entirely exit the loop, skip an iteration, or ignore the...

3 minutes read.

Paramiko Python Example

Python Programming Language Python programming language is one of the most used programming languages, as it is used widely in the field of software and data analysis, web development, etc. It...

6 minutes read.

Allocate a minimum number of pages in python

You have given a sorted array of size n which represents the number of pages in n different books and an integer value which denotes the number of students. We...

4 minutes read.

Python MySQL Delete Operation

Python MySQL Delete Operation: Like the update operation where we were updating required field from a SQL table, we can also delete an entry from the table which we have...

4 minutes read.

AES CTR Python

Python Programming Language  Python is an interactive and more accessible language than any other programming language. The python programming language uses a variety of libraries to perform the operations in a...

3 minutes read.

Type casting in Python

Introduction Type Casting is defined as the method of converting the variables/values data type into a certain data type for matching the operation needed to be performed by the users. This...

4 minutes read.

How to create a login page in python

Users can access an application by providing their username and Password or by authenticating with a social media login on the login screen. Python Tkinter Python provides a variety of choices for...

3 minutes read.

Anaconda python 3 installation for windows 10

If you are a problem solver and like to solve programming questions, the anaconda distribution for python could be one of the best options to use and solve problems in...

3 minutes read.

How to change a value of a tuple in Python

Python is the language for newly evolving technologies and has become one of the most popular programming languages in the world. It is used in everything right, from simple algorithm...

3 minutes read.

How to Install Tweepy in Python

In this article, we will learn or understand how to install Tweepy in Python and what Tweepy is. Firstly, let’s understand What Tweepy is. As we all know, one of the...

3 minutes read.

App Config Python

An XML file called App. Config serves as the document for any programme. In other terms, you can modify any configuration inside of it without going to edit the code...

7 minutes read.

Is Python Object Oriented Programming language

In this tutorial, we will see whether python also belongs to an object-oriented programming language like several others. We will also see the advantages of using OOPs. Further, we will...

4 minutes read.

Count Number of Keys in Dictionary Python

Dictionary is a particular data type in python. Dictionary stores unique values by taking different keys and their assigned values. Through this article, we will learn about python dictionary count,...

3 minutes read.

Python Line Break

Introduction In this tutorial, you will learn line breaks in python.In Python, the new line character is used to indicate the start of a new line and the end of an...

5 minutes read.

Compound Interest GUI Calculator using PyQt5 in Python

GUI: One of the most significant factors that increased the usability of computer and digital technologies for common, less tech-savvy users is likely the development and widespread adoption of GUIs. GUIs...

6 minutes read.

How to comment out a block of code in Python

When you are writing code in Python, you may want to document it. You need to mention why a piece of code functions, for instance. Mathematics, algorithms, and intricate business...

4 minutes read.

Python Printf Style Formating

String objects have one special implicit activity: the % administrator (modulo). This is otherwise called the string designing or interjection administrator. Given design % values (where configuration is a string),...

3 minutes read.

Managing Multiple Python Versions With pyenv

Introduction If you had ever wished to assist to an application that makes use of several different Python versions but weren't sure whether you would quickly test them all? Do you...

4 minutes read.