List all python versions installed on Mac OS

Method 1(Best Way):

Easy way is by executing the following command:

ls -ls /usr/bin/python*

You will get Output like this:

$ ls -ls /usr/bin/python*

32 -rwxr-xr-x  1 root  wheel  66880 Mar 28  2018 /usr/bin/python
0 -rwxr-xr-x  4 root  wheel    925 Jul 16  2017 /usr/bin/python-config
0 lrwxr-xr-x  1 root  wheel     75 Oct  3  2017 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
0 lrwxr-xr-x  1 root  wheel     82 Oct  3  2017 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
32 -rwxr-xr-x  1 root  wheel  66880 Mar 28  2018 /usr/bin/pythonw
0 lrwxr-xr-x  1 root  wheel     76 Oct  3  2017 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7

Method 2:

If you want to see all versions of Python available as commands, run:

 compgen -c python

You will get Output like this:

$  compgen -c python

python3

python

pythonw

python3.7-config

python3.7m

python3.7m-config

python3.7

python.app

python3-config

python3.5m-config

python2-config

python3

python

python2

pythonw

python3.6m-config

python3.7-config

python2.7-config

python3-32

python3.6-32

python3.7m

pythonw2.7

python3.6

python3.7m-config

python3.7

python3.5-config

python-config

python3-config

python3.5m

pythonw2

python3.6m

python3.5-32

python2.7

python3.6-config

python3.5

python

pythonw

python2.7-config

pythonw2.7

python-config

python2.7