Can you simply delete the directory from your python installation, or are there any lingering files that you must delete?
In ubuntu 12.04, I have found that the only place you need to look by default is under
/usr/local/lib/python2.7/
And simply remove the associated folder and file, if there is one!
install --record
+ xargs rm
sudo python setup.py install --record files.txt
xargs sudo rm -rf < files.txt
removes all files and but leaves empty directories behind.
That is not ideal, it should be enough to avoid package conflicts.
And then you can finish the job manually if you want by reading files.txt
, or be braver and automate empty directory removal as well.
A safe helper would be:
python-setup-uninstall() (
sudo rm -f files.txt
sudo python setup.py install --record files.txt && \
xargs rm -rf < files.txt
sudo rm -f files.txt
)
Tested in Python 2.7.6, Ubuntu 14.04.
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.
If this is for testing and/or development purposes, setuptools has a develop command that updates every time you make a change (so you don't have to uninstall and reinstall every time you make a change). And you can uninstall the package using this command as well.
If you do use this, anything that you declare as a script will be left behind as a lingering file.
On Mac OSX, manually delete these 2 directories under your pathToPython/site-packages/ will work:
for example, to remove pyasn1, which is a distutils installed project:
To find out where is your site-packages:
python -m site
for Python in Windows:
python -m pip uninstall "package_keyword"
uninstall **** (y/n)?