How can I print the version number of the current Python installation from my script?
515
votes
5 Answers
650
votes
Try
import sys
print(sys.version)
This prints the full version information string. If you only want the python version number, then Bastien Léonard's solution is the best. You might want to examine the full string and see if you need it or portions of it.
36
votes