Last Updated on December 26, 2020 by Roshan Parihar
In this tutorial, learn how to find the version of Python package installed. The short answer is to use the python_version()
as given in the examples here. There are many versions of Python available today. You can find the version of the Python package installed on your computer system.
After you install Python on your system, you may want to know the version of Python. In that condition, you should know several methods of Python to get the installed Python version.
Get History Details of Python With sys Module
The sys module of Python gives a version of Python with installed date and time. If you want to know at which time you have installed Python on your system. Then, this method gives you more on execution.
You can also find whether the installed Python is 32bit or 64 bit.
You have to first import the sys module using the below method. After that, use the sys.version
with the print function to print version in the output.
Check the below method to find the version installed on your computer system.
1 2 |
import sys print(sys.version) |
Output
The above example gives you version, date and time of installation in the output. It contains much information for the user to find everything about installed Python.
However, if you want to get only the version of Python and not other information. Then, the below-given method is the best method to get this.
Find Current Version of Python Version
If you want to find only the version of Python on your computer system. You can use the platform python_version
.
To perform this task, you have to first import the platform python_versions using the import
keyword. After that, you have to use the python_version()
function with the print function.
Check the below example to find only the version. This prints the version of Python in the output on execution.
1 2 |
from platform import python_version print(python_version()) |
Output
The above example prints only the version of the Python in the output. It confirms that the version of the Python installed on the computer is 3.7.0.
You may also like to read
- Download and install Python on Windows 10
- How to execute the Python program or code on Windows
- Best IDE Text Editor For Python You Should Know
I hope you like this post on how to find the version of Python installed.
Reference
Stackoverflow Discussion on Getting installed history of Python