Uninstall python built from source?

Ian P picture Ian P · Aug 23, 2010 · Viewed 63.8k times · Source

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.

Answer

unutbu picture unutbu · Aug 23, 2010

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.