Skip to content
Related Articles
Open in App
Not now

Related Articles

Check the Version of the Python Interpreter

Improve Article
Save Article
  • Last Updated : 26 Aug, 2022
Improve Article
Save Article

In this article, we will get to know the current version of the Python interpreter in the system. Getting the version of the interpreter is really important as the python interpreter is widely used throughout the industries for computer programming and source coding. It takes an interactive command and executes it. 

As the interpreter is the one which takes the code and helps in execution. Sometimes the old version of the interpreter-making command doesn’t work properly and as we know the language python comes with frequent update vision with some added new features, so the user must update the interpreter with the latest release version.

How to check what version of Python?

To get the Version of the python Interpreter, they are listed as follows:

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

Method 1. Using sys.version method:

For this method, the user needs to import the sys library and from sys.version command which will return the user’s current python version in the use. For this method, the user must open the Python shell and write the following command as given below, with this command the user will get the current working version of the python interpreter in the form of a string.

Here is some step that the user must follow to get the currently running version of the python interpreter:

  1. Open cmd/terminal/windows powershell
  2. Write ‘python’ and press enter key to move into Python interpreter
  3. Write the same command given in the input box below, and in the result, the user will get the current interpreter version.

Python3




import sys
 
 
print("User Current Version:-", sys.version)

Output:

 

Method 2. Using python_version() function

This function is accessible by importing the platform library and will always return a string of the running user’s python version. For better understanding one can go with the following steps:-

  1. Open cmd/terminal/windows powershell
  2. Write ‘python’ and press enter key to move into the Python interpreter
  3. Now, write the same command as mentioned below in the code box given, and press enter, with this it will return the current python interpreter version in the form of a string.

Python3




from platform import python_version
 
 
print("Current Python Version-", python_version())

Output:

 

Method 3. Using python -V command

This method is one of the simplest methods among all other methods as in this method users get the current python version with one of the inbuilt commands present in python.

Here are some steps that the user must follow to get its current running version of the python interpreter:-

  1. Open cmd/terminal/windows powershell
  2. Now, write the same command as mention below in the code box given, and press enter, with this it will return the current python interpreter version in the form of a string.
 python -V

Output:

 

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!