Take the 2-minute tour ×

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?

share|improve this question
Try re-installing python (easiest way is Synaptic). –  loki2302 Sep 12 '11 at 10:02
add comment

migrated from stackoverflow.com Sep 12 '11 at 11:15

This question came from our site for professional and enthusiast programmers.

5 Answers

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.)

share|improve this answer
Note johanvdw's answer below. The "local" means you've installed it not using the normal package management system. –  ed. Sep 12 '11 at 15:45
add comment

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).

share|improve this answer
add comment

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

share|improve this answer
add comment

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).

share|improve this answer
add comment
up vote 1 down vote accepted

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
share|improve this answer
add comment

Your Answer


