Skip to content Skip to sidebar Skip to footer

My Python Doesn't Work

I accidentally replace python binary files located at /usr/local/bin/. Since then, I can't run any python script or even run the interactive mode of python. $ python Traceback (mo

Solution 1:

The problem is that you're hitting /usr/local/bin/python instead of /usr/bin/python.

You can either move it out of the way by running something like...

mv /usr/local/bin/python /usr/local/bin/python.old

...as root, or if you're sure you don't need it, then just delete it with...

rm /usr/local/bin/python

If bash still tries to run /usr/local/bin/python, and running type python prints...

python is hashed (/usr/local/bin/python)

...then do hash -r to clear the hash table.

It's not a good idea to copy /usr/bin/python to /usr/local/bin/python, otherwise you may get problems the next time you update python with apt-get upgrade, i.e. it'll update /usr/bin/python, but /usr/local/bin/python will still be run by default.


Solution 2:

Looks like this has something to do with a Python build made specially for debugging.

I'd suggest you reinstall Python with apt-get:

sudo apt-get install --reinstall python2.7

Your question seems to be the same like this SO question about sys.pydebug


Solution 3:

You have to reinstall. This is a better solution. This is the my favoruite installation with terminal on Ubuntu. Try: Install Python and cherrypy

And you look on the answer on this question

Installation python


Post a Comment for "My Python Doesn't Work"