Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Unfortunately I deleted the /usr/bin/python in my ubuntu 12.04 I went to /usr/bin/ and run

ls -al

then I got

lrwxrwxrwx 1 root root      64 Jul 13 14:58 python -> /Library/Frameworks/Python.framework/Versions/Current/bin/python 

How do I link that python so that I can get python in terminal on running python

I also reinstalled python by

apt-get --purge --reinstall install python

I tried adding sym link like ln -s /usr/lib/python2.7/ /usr/bin/python then it thrown in ln: failed to create symbolic link/usr/bin/python': File exists`

share|improve this question
What? "python -> /Library/Frameworks.." Looks like a Mac OS X path. How did you get that there? – gertvdijk Jul 15 '13 at 6:29
up vote 2 down vote accepted
  1. Boot up in recovery mode or something. I guess your current system state won't make it to the GUI without Python.

  2. Remove the current dead link.

    rm /usr/bin/python
  3. Recreate the link

    ln -s /usr/bin/python2.7 /usr/bin/python

Don't forget to prepend the commands with sudo if you aren't root at that point.

share|improve this answer

Use the following commands:

sudo unlink /usr/bin/python                     #to delete the previous symbolic link
sudo ln -s /usr/lib/python2.7 /usr/bin/python   #to recreate the new correct symbolic link
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.