Skip to content
Related Articles

Related Articles

Check the Version of the Python Interpreter
  • Last Updated : 24 Jan, 2021
GeeksforGeeks - Summer Carnival Banner

Under this article, we will get to know the current version of 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 due to 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.

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

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 are some step that user must follow to get its current 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:

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 python interpreter
  3. 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 string.

Python3




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

Output:

3.Using  python -V command:-

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

Here are some step that 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 string.
 python -V

Output:


Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :