I’m just getting started with a Centos server and observed that the default Python version on Centos is 2.6.6. Instead, I’d like to utilize Python 2.7. I did some research and discovered that 2.6.6 is needed by system utilities like YUM, therefore I shouldn’t mess with it. Then I went to my Mac’s terminal and discovered that I had Python 2.6.8, 2.7.5, and 3.3.3 installed. Please accept my apologies for the lengthy story. In brief, I’d like to know how to find all the versions of Python that are installed on Centos so that I don’t install it twice.
Asked by hch
The simplest method is to use the following command:
ls -ls /usr/bin/python*
The following is an example of the output:
/usr/bin/python /usr/bin/python2.7 /usr/bin/pythonw /usr/bin/python-config /usr/bin/python2.7-config /usr/bin/pythonw2.7
Answered by Gabriel Caceres
We can run the following command to see all the Pythons installed by both the current user and the root: Python’s location is unknown.
Answered by Ke Li
Using the command python —version:, determine which version of Python is installed. —version Python 2.7.10 $ python
Python 2.7 is the default version if you see something like this. You can also check if Python 3 is installed:
$ python3 --version Python 3.7.2
With python and python3, you can use the command “which” to find out where it is installed as well:
$ which python /usr/bin/python $ which python3 /usr/local/bin/python3
Answered by KPandian
Here’s a less obtrusive approach to demonstrate your point (technically without symbolic links). This applies to both Python 2 and Python 3 installations:
ls -1 /usr/bin/python* | grep '.*[2-3]\(.[0-9]\+\)\?$'
Where grep looks for the numeric pattern at the end of the ls output ($).
Or using find:
find /usr/bin/python* ! -type l
Which displays all of the numerous (!) types of symbolic links (-type l).
Answered by danbros
yum list installed
Answered by lpsandaruwan
Post is based on https://stackoverflow.com/questions/30464980/how-to-check-all-versions-of-python-installed-on-osx-and-centos