简体   繁体   中英

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.

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 altinstall ed 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM