Thursday, September 21, 2023
rated 0 times [  10] [ 0]  / answers: 1 / hits: 10514  / 2 Years ago, fri, march 25, 2022, 10:21:15

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`

More From » command-line


  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.

[#30319] Sunday, March 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 456
Total Questions: 130
Total Answers: 98

Location: El Salvador
Member since Sun, Sep 12, 2021
2 Years ago