There are many versions of Python available today. You can find the version of Python package installed on your computer system.
After you install Python on your system, you may want to know the version of the 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 of 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.
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
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.
from platform import python_version
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
Hope, you like this post of how to find the version of Python installed. If you have any query regarding the tutorial, please comment below.
Also tell me, which method you are using to get the version of your installed Python package.