2

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`

1
  • 3
    What? "python -> /Library/Frameworks.." Looks like a Mac OS X path. How did you get that there?
    – gertvdijk
    Jul 15, 2013 at 6:29

2 Answers 2

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

1
  • This is really helpful, it saved my day. Feb 15, 2018 at 9:11
0

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

You must log in to answer this question.

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