Do I have multiple python on my computer? and how to uninstall one of them?
which python
only tells you the executable that would be run with the command python
, i.e. it typically returns exactly one result per argument, unless you specify -a
, in which case it searches all the directories in the $PATH
environment variable. But in all cases it is the same python
command.
If you want to know how many versions of python are installed on your system, you're better off with locate /python | grep /bin
or ls -l /usr/bin/python*
or yum --showduplicates list python
.
As for your two python
instances, chances are one of them is a [symbolic] link: check with which -a python | xargs ls -li
. If you want to remove a specific version of python then you'll have to specify that version number on the yum
command line, e.g. : yum remove python-2.7.2.el5s2
.
EDIT: As mattdm reports, /bin
is a symbolic link to /usr/bin
on Fedora. Consequently you cannot delete python from either of these locations with rm
otherwise you'd end up deleting python at all. The -i
argument to ls
in which -a python | xargs ls -li
will in this case show that both python instances have the same inode.
Just note that you are not required to manually remove version-specific packages since the package manager's purpose is precisely to pull versions adequately, as per dependency requirements. If a specific version is installed then it is there for a good reason. Removing one is likely to rid other packages along.
Finally use your distribution's package manager by all means to install packages and their dependencies, especially those that belong to the distribution's repository... unless impossible otherwise. I might be wrong but if you count on pip
to update some of the main packages then the package manager will be confused and most probably mess up with the dependencies you satisfied by hand. (In fact it's the other way around: letting pip
manage dependencies will likey mess up with yum
.)
On all recent Fedora releases, /bin
is a symlink to /usr/bin
— which means if you look in /bin, you actually get redirected to the /usr/bin. However, both appear in $PATH
(hmmm; that probably should be cleaned up), and that's what you're seeing with which -a python
— two ways to get to an actually-identical binary.
So, there's no problem here.
(Note, though, that mixing pip and rpm (yum) installation can give confusing results and possibly install duplicate versions of things.)