Python: Print Version String from Script
Print version from the command line:
Print version number from within the script.
# python 3 import sys print(sys.version) # 3.7.1 (default, Dec 14 2018, 13:28:58) # [Clang 4.0.1 (tags/RELEASE_401/final)]
Printing version from script is a important technique to find out which version your script is running. Because, you might have several version installed, and in terminal, there are aliases, links, path environment variables, various shell init scripts, that effect which Python version will start when you type
python in shell.