Uninstall python built from source?

PythonLinuxUbuntuPython 2.x

Python Problem Overview


I've installed python 2.6 from source, and somehow later mistakenly installed another python 2.6 from a package manager too.

I can't find a way to uninstall a python that was built from source, is this possible/easy?

Running ubuntu 10.04.

Python Solutions


Solution 1 - Python

You can use checkinstall to remove Python. The idea is:

  1. Install checkinstall
  2. Use checkinstall to make a deb of your Python installation
  3. Use dpkg -r to remove the deb.

See this post for more details.

PS. Note that Ubuntu must always have at least one installation of Python installed, or else major pieces of your OS stop working. Above, I'm assuming it's safe to remove the Python built from source, without removing the Python that was installed by the package manager.

PPS. If you accidentally erase all Python installations from your Ubuntu machine, all is not lost. Instructions on how to recover from this situation can be found here.

Solution 2 - Python

Have you looked into make uninstall I believe this should work for you, assuming you have the python 2.6 source and the make file has uninstall available (it should).

http://www.linuxquestions.org/questions/linux-newbie-8/source-uninstall-with-make-uninstall-howto-230225/

Solution 3 - Python

In the future it may be prudent to use sudo checkinstall.

Solution 4 - Python

I did the following and reinstall using 'make install' and it worked.

whereis python3.6
rm -rf /usr/local/lib/python3.6
rm -rf /usr/local/bin/python3.6*
make install

Solution 5 - Python

Below command removed all the things it installed for me.

make -n install

Solution 6 - Python

Do you still have the source directory where you compiled Python before? If so, you can CD into that directory and run sudo make uninstall.

If you don't have it still, you could re-create it by going through the build steps again--download, extract, configure, and make--but end with sudo make uninstall instead of sudo make install, of course.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIan PView Question on Stackoverflow
Solution 1 - PythonunutbuView Answer on Stackoverflow
Solution 2 - PythonJulioView Answer on Stackoverflow
Solution 3 - PythonmaletorView Answer on Stackoverflow
Solution 4 - PythondasView Answer on Stackoverflow
Solution 5 - PythonExploringAppleView Answer on Stackoverflow
Solution 6 - PythonewallView Answer on Stackoverflow