Check the Version of the Python Interpreter - GeeksforGeeks

24 Jan, 2021
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:-
Open cmd/terminal/windows powershellWrite ‘python’ and press enter key to move into python interpreterWrite the same command given in the input box below, and in the result, the user will get the current interpreter version.
Open cmd/terminal/windows powershell
Write ‘python’ and press enter key to move into python interpreter
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:-
Open cmd/terminal/windows powershellWrite ‘python’ and press enter key to move into python interpreterNow, 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.
Open cmd/terminal/windows powershell
Write ‘python’ and press enter key to move into python interpreter
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:-
Open cmd/terminal/windows powershellNow, 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.
Open cmd/terminal/windows powershell
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:
Picked
Python-sys
python-utility
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
Selecting rows in pandas DataFrame based on conditions
How to drop one or multiple columns in Pandas Dataframe
How To Convert Python Dictionary To JSON?
Check if element exists in list in Python
Python | Get unique values from a list
Defaultdict in Python
Python OOPs Concepts
Python | os.path.join() method
Python | Pandas dataframe.groupby()