Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you cleanly remove Python when it was installed with 'make altinstall'?

How do you cleanly remove Python when it was installed with make altinstall? I'm not finding an altuninstall or such in the makefile, nor does this seem to be a common question.

In this case I'm working with Python 2.7.x in Ubuntu, but I expect the answer would apply to earlier and later versions/sub-versions.

Why? I'm doing build tests of various Python sub-versions and would like to do those tests cleanly, so that there are no "leftovers" from other versions. I could wipe out everything in /usr/local/lib and /usr/local/bin but there may be other things there I'd like not to remove, so having a straightforward way to isolate the Python components for removal would be ideal.

like image 578
MartyMacGyver Avatar asked Jun 19 '13 17:06

MartyMacGyver


1 Answers

As far as I know, there’s no automatic way to do this. But you can go into /usr/local and delete bin/pythonX and lib/pythonX (and maybe lib64/pythonX).

But more generally, why bother? The whole point of altinstall is that many versions can live together. So you don't need to delete them.

For your tests, what you should do is use virtualenv to create a new, clean environment, with whichever python version you want to use. That lets you keep all your altinstalled Python versions and still have a clean environment for tests.

Also, do the same (use virtualenv) for development. Then your altinstall’ed Pytons don't have site packages. They just stay as clean, pristine references.

like image 190
andrew cooke Avatar answered Oct 14 '22 05:10

andrew cooke