Upgrade python packages with pip: use “sudo” or “–user”?

pip install -U PACKAGENAME --user

With --user they are installed in your $HOME directory in:

$HOME/.local/lib/python2.7/site-packages

Using sudo your package will be installed in:

/usr/local/lib/python2.7/dist-packages/

python: uninstall python 2.7 install via source

To completely remove python you can execute:

rm -f /usr/local/bin/python2.7
rm -f /usr/local/bin/pip2.7
rm -f /usr/local/bin/pydoc
rm -rf /usr/local/bin/include/python2.7
rm -f /usr/local/lib/libpython2.7.a
rm -rf /usr/local/lib/python2.7

You might also have to do

rm -f /usr/local/share/man/python2.7.1
rm -rf /usr/local/lib/pkgconfig
rm -f /usr/local/bin/idle
rm -f /usr/local/bin/easy_install-2.7