I accidentally deleted /usr/bin/python and now I can't run my terminal - gnome-terminal. When I try to run it using XTerm it says:

/usr/bin/python3: bad interpreter: no such file or directory

When I symlink /usr/bin/python3 with the Python that I downloaded then it says that I am missing some packages (for example Gi)

How can I return it back to working as it used to be? I am running Ubuntu 16.04.

I think that the problem is that this Ubuntu version has some packages that the new python that I installed don't have.

I tried installing python3-minimal but it says that I don't have py3compile and py3clean

  • 1
    Are you sure that /usr/bin/python is all that you deleted? On Ubuntu 16.04, AFAIK that should have just been a symbolic link to /usr/bin/python2.7 What "new python" did you install, and how, exactly? – steeldriver Nov 26 '16 at 18:59
  • I deleted all python that was under /usr/bin. By new python I meant, python 3.5. I compiled it from source and linked it to /usr/bin/python – Lee Nov 26 '16 at 19:00
  • xterm doesn't depend upon python (though the desktop may...). switching to a virtual console would let you run apt-get to restore things. – Thomas Dickey Nov 26 '16 at 19:09
  • XTerm works, but when I run apt-get it gives me "No Module Debian".. – Lee Nov 26 '16 at 19:23
  • Boot into single user mode, solve your problems there, and change to multi-user mode. – boardrider Nov 26 '16 at 22:33

Turns out that when I installed python from source, it didn't look at dist-packages which is where the debian module was. So, I copied all the files from dist-packages to site-packages. And then linked python3 to /usr/bin/python And started installing stuff again..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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