You can not use apt-get
to uninstall python since you did not use it or any pre-built package to install python. It just simply doesn't know about this installation so it can not undo the installation.
Initial solution:
(It came out later in the comments that the user has already tried to do this.)
There is a popular post about this on [StackOverflow]:https://stackoverflow.com/questions/1550226/python-setup-py-uninstall.
Copied from the site:
You need to remove all files manually, and also undo any other stuff that installation did manually.
If you don't know the list of all files, you can reinstall it with the --record
option, and take a look at the list this produces.
To record list of installed files, you can use:
python setup.py install --record files.txt
Once you want to uninstall you can use xargs to do the removal:
cat files.txt | xargs rm -rf
Second solution:
The reason why you are getting the python from /usr/local/bin/
and not from /usr/bin/
is that the first folder comes before the second in your $PATH variable. So the system finds the manually installed version of python first. We can clean this part of the system easily.
If you are sure that there should only be the original python installed on your system then do the following:
cd /usr/local/bin/
sudo rm python python-config python2 python2-config python2.7 python2.7-config
Side note: The general idea of not using *
here is to avoid people accidentally deleting files from their main python installation.
Since you have run several uninstallation methods it would be tricky to be a 100% sure that you managed to remove everything but this way you would be be able to use the default python.
ls -l /usr/bin/python /usr/local/bin/python
and/usr/bin/python --version
sudo pip uninstall python
from ~/Downloads/Python-2.7.8 directory. It dislpalyedUninstalling python: /usr/local/lib/python2.7/lib-dynload/Python-2.7.8-py2.7.egg-info
. Then displayed "Successfully uninstalled python". Butpython --version
andwhich python
still give the same output.lrwxrwxrwx 1 root root 9 Dec 21 2013 /usr/bin/python -> python2.7
andlrwxrwxrwx 1 root root 7 Nov 20 21:16 /usr/local/bin/python -> python2
sudo easy_install pip
, thenpip freeze
. It gives output aswsgiref==0.1.2
. Then I didpip uninstall wsgiref
but it gives error. Also, when I runpython setup.py develop
from ~/Downloads/Python2.7.8 directory, it gives error.