Linux – Clear remove of additional Python from usr/local/ on Ubuntu

linuxpythonUbuntu

I need to use a machine at work (12.04 Ubuntu box) that has two versions of Python installed: the default 2.7.3 one from the /usr/bin and a 2.7.5 one that was installed into usr/local/bin. The isntallation wasn't clean, in the sense no alt-install was used and the python now redirects to the 2.7.5.

I don't know how long it was there or what kind of python-dependent tools have been installed after over it. The problem is that pip was installed only for the 2.7.3, but tries to install into the 2.7.5 folders, making compilation of numpy or scipy impossible.

What is the cleanest way of removing the 2.7.5 without breaking any dependencies or, in the worst case, redirecting them onto the 2.7.3?

Best Answer

to redirect python to 2.7.3 type in terminal

sudo update-alternatives --config python

and then select the version of python most likely 3

to remove pythn 2.7.5 use apt-get i.e

 sudo apt-get remove python2.7-5

then run

sudo  apt-get autoremove

to remove any dependancies not needed

Related Question