linux – How to check all versions of python installed on osx and centos

linux – How to check all versions of python installed on osx and centos

The more easy way its by executing the next command:

ls -ls /usr/bin/python*

Output look like this:

/usr/bin/python           /usr/bin/python2.7        /usr/bin/pythonw
/usr/bin/python-config    /usr/bin/python2.7-config /usr/bin/pythonw2.7

we can directly use this to see all the pythons installed both by current user and the root by the following:
whereis python

linux – How to check all versions of python installed on osx and centos

Find out which version of Python is installed by issuing the command
python –version:
$ python –version
Python 2.7.10

If you see something like this, Python 2.7 is your default version. You can also see if you have Python 3 installed:

$ python3 --version
Python 3.7.2

If you also want to know the path where it is installed, you can issue the command which with python and python3:

$ which python
/usr/bin/python

$ which python3
/usr/local/bin/python3

Leave a Reply

Your email address will not be published.