Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to install and uninstall Python package from source

📅 2014-May-30 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ install, package, python, uninstall ⬩ 📚 Archive

A lot of Python packages are only available as source code.


To install such a Python package, use its file:

$ sudo python install

This will install the Python files to a central location such as /usr/local/lib. If you do not have such permissions or want to install to a user-local location then try this:

$ python install --home /home/joe/python_libs


To uninstall a package is tricky.

One solution is to find out where the files were installed and then use that list to remove those files:

$ sudo python install --record install-files.txt
$ cat install-files.txt | sudo xargs rm -rf

Another solution is to just locate the installation directory, like /usr/local/lib/python2.7/dist-packages for example and delete the directory of the package.

Tried with: Python 2.7.6 and Ubuntu 14.04