How to check all versions of python installed on osx and centos
NickName:hch Ask DateTime:2015-05-27T01:18:26

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

I just started setting up a centos server today and noticed that the default version of python on centos is set to 2.6.6. I want to use python 2.7 instead. I googled around and found that 2.6.6 is used by system tools such as YUM so I should not tamper with it. Then I opened up a terminal on my mac and found that I had python 2.6.8 and 2.7.5 and 3.3.3 installed. Sorry for the long story. In short I just want to know how to lookup all the version of python installed on centos so I don't accidentally install it twice.

Copyright Notice:Content Author:「hch」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30464980/how-to-check-all-versions-of-python-installed-on-osx-and-centos

Answers
jm13fire 2015-05-26T18:15:53

As someone mentioned in a comment, you can use which python if it is supported by CentOS. Another command that could work is whereis python. In the event neither of these work, you can start the Python interpreter, and it will show you the version, or you could look in /usr/bin for the Python files (python, python3 etc). ",


nurealam siddiq 2019-09-09T03:39:32

It depends on your default version of python setup. You can query by Python Version:\n\npython3 --version //to check which version of python3 is installed on your computer\npython2 --version // to check which version of python2 is installed on your computer\npython --version // it shows your default Python installed version.\n",


Appaji Chintimi 2020-12-13T13:16:35

compgen -c python | grep -P '^python\\d'\n\nThis lists some other python things too, But hey, You can identify all python versions among them.",


tsm 2021-08-19T09:34:38

Sift through the output of this script.\nsudo find / -name 'python*' -type f -exec du -h {} + | sort -r -h ~/Documents/python_locations.txt\n",


Gabriel Caceres 2016-08-23T12:34:59

The more easy way its by executing the next command:\n\nls -ls /usr/bin/python*\n\n\nOutput look like this:\n\n/usr/bin/python /usr/bin/python2.7 /usr/bin/pythonw\n/usr/bin/python-config /usr/bin/python2.7-config /usr/bin/pythonw2.7\n",


george mano 2021-10-11T22:34:41

ls -l /usr/bin/python* & ls -l /usr/local/bin/python*\n",


Ke Li 2019-06-15T00:51:13

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


Singh 2021-11-28T13:55:42

I would add to @nurealam siddiq answer,\npython --version // it shows your default Python installed version.\n\npython2 --version // to check which version of python2 is installed \n\npython3 --version //to check which version of python3 is installed \n\npython3.X --version // to further check which python3.X is installed\n\n",


KPandian 2019-03-13T15:35:31

Find out which version of Python is installed by issuing the command \npython --version:\n $ python --version\n Python 2.7.10\n\nIf you see something like this, Python 2.7 is your default version. You can also see if you have Python 3 installed:\n\n$ python3 --version\nPython 3.7.2\n\n\nIf you also want to know the path where it is installed, you can issue the command \"which\" with python and python3:\n\n$ which python\n/usr/bin/python\n\n$ which python3\n/usr/local/bin/python3\n",


Jatin 2023-02-11T14:58:11

To check python versions installed in your OS you can run the below commands:-\npython2 -version\npython3 -version\n",


danbros 2019-08-13T21:04:11

Here is a cleaner way to show them (technically without symbolic links). This includes python2 and python3 installs:\nls -1 /usr/bin/python* | grep '.*[2-3]\\(.[0-9]\\+\\)\\?$'\n\nWhere grep filters the output of ls that that has that numeric pattern at the end ($).\nOr using find:\nfind /usr/bin/python* ! -type l\n\nWhich shows all the different (!) of symbolic link type (-type l).",


lpsandaruwan 2015-05-26T18:31:41

Use, yum list installed command to find the packages you installed.",


Alan O'Meara 2019-09-30T17:19:14

COMMAND: python --version && python3 --version\n\nOUTPUT:\n\n\n Python 2.7.10 \n Python 3.7.1\n\n\nALIAS COMMAND: pyver\n\nOUTPUT:\n\n\n Python 2.7.10 \n Python 3.7.1\n\n\nYou can make an alias like \"pyver\" in your .bashrc file or else using a text accelerator like AText maybe.",


More about “How to check all versions of python installed on osx and centos” related questions

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

I just started setting up a centos server today and noticed that the default version of python on centos is set to 2.6.6. I want to use python 2.7 instead. I googled around and found that 2.6.6 is ...

Show Detail

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

I just started setting up a centos server today and noticed that the default version of python on centos is set to 2.6.6. I want to use python 2.7 instead. I googled around and found that 2.6.6 is ...

Show Detail

Check all installed python versions on linux

I use conda(anaconda) environments and wanted to test some syntax in py3.8. Is there a way in which I can check all the installed python versions in my pc(across all conda envs). I have tried ls -l...

Show Detail

easy_install with various versions of python installed, mac osx

I have various versions of python on a mac OSX 10.6 machine, some of them installed with macports: > python_select -l Available versions: current none python24 python26 python26-apple python27 ...

Show Detail

How can I check all the installed Python versions on Windows?

Please note I'm not asking "how to check which version of Python did I install". I've installed several versions of Pythons on my Windows computer, for example Python 2.7-64, Python 2.7-3...

Show Detail

Different python versions in centos

I have a centos 7 machine , which has 2 python versions , python giver sveriosn 2.7.5 and python2.7 givers version . 2.7.13. I want to make 2.7.13 as default version, such that when I check python --

Show Detail

which folder python 2.6 is installed in centos 6.5

Actually I installed python 2.6 in CentOS 6.5 and want to run a command on start up time in CentOS 6.5. I installed watchdog also so that can monitor activity for a folder printing located at /var/...

Show Detail

How do I uninstall all user installed python and pip versions?

Also asked at AskUbuntu There are several python2 and python3 versions installed when I cheched /usr/bin/ directory. I want to uninstall all user installed versions of python and leave only the ve...

Show Detail

How to check jenkins is installed in centos or not?

how to check Jenkins is installed in centOS7 or not? Is there any command for that?. Thanks!!

Show Detail

Python will not recognize MacPorts installed packages

Thank you in advance for the advice! Background: Relative to the people on this site I'm new to programming, and despite some research I'm not familiar with using Unix-type shells, with what mana...

Show Detail