python -version code example
Example 1: python version
python ––version
Example 2: python version command
import sys
print(sys.version)
Example 3: latest version of python
# For macs...
# Apparently you don't want to upgrade 2.* just install 3.*
% brew install python3