How do you uninstall a python package that was installed using distutils?
Solution 1:
It varies based on the options that you pass to install
and the contents of the distutils configuration files on the system/in the package. I don't believe that any files are modified outside of directories specified in these ways.
Notably, distutils does not have an uninstall command at this time.
It's also noteworthy that deleting a package/egg can cause dependency issues – utilities like easy_install
attempt to alleviate such problems.
Solution 2:
The three things that get installed that you will need to delete are:
- Packages/modules
- Scripts
- Data files
Now on my linux system these live in:
- /usr/lib/python2.5/site-packages
- /usr/bin
- /usr/share
But on a windows system they are more likely to be entirely within the Python distribution directory. I have no idea about OSX except it is more likey to follow the linux pattern.
Solution 3:
Another time stamp based hack:
- Create an anchor:
touch /tmp/ts
- Reinstall the package to be removed:
python setup.py install --prefix=<PREFIX>
- Remove files what are more recent than the anchor file:
find <PREFIX> -cnewer /tmp/ts | xargs rm -r