1

I was banging my head off the wall trying to change the path of pip install on my Ubuntu install. I guessed that it may have been the number of Python installations on my machine. I ended up accidentally deleting python and python3 from /usr/bin/.

Now nothing works. Both apt-get and sudo no longer work. Every command I run, I get the same output:

-bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such file or directory

I deleted the contents of /home/ubuntu/usr/bin. I was able to re-create that folder and I copied the files from /root/usr/bin/. I have also copied python3 and python into /home/ubuntu/usr/bin.

I am still getting the error:

-bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such file or directory

I am honestly navigating in the dark, any help would greatly appreciated.

Grammargeek
  • 2,762

1 Answers1

1

You're likely running into issues with Ubuntu's "Command not found, did you mean [X]?" feature, which I believe is written in Python which would explain the issue you're facing.

Something you can try is changing your terminal's shell to /bin/sh, which shouldn't have the issue (because it doesn't load profiles). From this point you should be able to fix your system and get Python installed again.

Grammargeek
  • 2,762