Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (19k points)

How can I print the version number of the current Python installation from my script?

1 Answer

0 votes
by (106k points)

For printing the version number of the current Python installation you can use the following piece of code:-

This code will return the version information string.

import sys

print(sys.version)

image 

If you only want the version number then you can use the following piece of code:-

import platform

print(platform.python_version())

image

Related questions

0 votes
1 answer
asked Dec 30, 2020 in Python by ashely (50.2k points)
0 votes
1 answer
asked Dec 2, 2020 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Jul 10, 2019 in Python by Sammy (47.6k points)

Browse Categories

...