setup.py uninstall
ContentsUnix-like
Install over the existing installation with the same sources, recording installed files, then delete them.
sudo python setup.py install --record files.txt
# inspect files.txt to make sure it looks ok. Then in bash:
tr '\n' '\0' < files.txt | xargs -0 sudo rm -f --
Windows
Install on top of the existing installation with a windows installer, then add-remove programs to uninstall.
python setup.py bdist_wininst
dist/foo-1.0.win32.exe
Use other methods which fully support uninstall when available
Uninstalling setup.py install has some inherent problems, which usually aren't a problem:
- Files which a different package also depends on will be removed by uninstall
- Can't remove installed directories. --record only records non-directory files.
- If a file is installed which includes a newline, the command this page recommends will fail. This won't happen except for a rare bug or a malicious program. We could overcome this by using bdist_dumb, then removing the files found in the archive which that command builds. However, I'm no more confident of that command not having a bug or edge case in which it would produce different files than a normal install than I am of a package having a file with a newline in it.
Alternatives
- pip
- python setup.py install bdist_rpm
- python setup.py bdist_wininst
- official python recommendations
This page is also at stackoverflow answer.
TODO: contribute this under https://wiki.python.org/moin/Distutils/Cookbook.