In an attempt to get CairoPlot to run correctly on my Ubuntu 11.04, I stupidly copied the CairoPlot.py into my /usr/local/bin/python dir. When I realized that this wasn't the way to go, I deleted the file, now running 'python' in terminal just hangs, I have restarted the machine, any ideas?

  • 1
    Try re-installing python (easiest way is Synaptic).
    – loki2302
    Commented Sep 12, 2011 at 10:02

5 Answers 5

sudo apt-get --reinstall install python

This will reinstall python from the command line, if you don't want to use Synaptic like loki2302 suggests. (Synaptic would be fine, of course.)

  • Note johanvdw's answer below. The "local" means you've installed it not using the normal package management system.
    – ed.
    Commented Sep 12, 2011 at 15:45

Since you have an error after touching a file in /usr/local/bin, reinstalling python the ubuntu is most likely not needed and won't help at all.

Probably you have installed a version of python yourself in /usr/local, which is now damaged. You can verify this by running /usr/bin/python. This should still work, whereas /usr/local/bin/python should give your error.

In this case you should uninstall your own version of python. If you still have the sources available you can use sudo make uninstall. Otherwise you should delete the python programs in /usr/local/bin (note the local).


other wise if the Python won't run in terminal post does not work

Try purge python which will remove all files and directories installed. It will also let you know if it can't remove a directory because there were files in it that it could not delete. You might find there was an other file in there that was causing problems. Which you should also delete.

sudo apt-get purge python
sudo apt-get install python


I would guess that /usr/local/bin/python has /usr/bin/env python set as interpreter, hence making it run in infinite loop. (since /usr/local/bin comes before /usr/bin/ in $PATH.

Type which python, and if it is /usr/local/bin/python, then just delete/rename that file. Packaged python is installed in /usr/bin/python and will work again. (Try which python, it should give you /usr/bin/python now).


What worked for me, was to start the

apt-get purge python

then kill it after a few minutes, then open a new terminal and:

apt-get --reinstall install python

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .