earlier my default python version is python2.7 to upgrade it I deleted python form /usr/bin/ and rename python3.6 as python in the same directory. afterward, my terminal is not working. its gets no response on opening it. please help!!

  • Welcome to Ask Ubuntu! Which version of Ubuntu are you using? How did you delete /usr/bin/python and how did you rename /usr/bin/python3.6 as /usr/bin/python? – wjandrea Dec 2 '18 at 20:31
  • 1
    DO NOT rename python3.6 as python. Doing so will break your system quite horribly. Depending upon the version of Ubuntu you are using, it might be recoverable, it might not. – user535733 Dec 2 '18 at 20:33
  • ubuntu version-18.10, I deleted by going in the desired directory and simply by using the command rm command and rename it by mv python3.6 python – the unknown Dec 3 '18 at 18:53

The main lesson here is not to mess with system files unless you know exactly what you're doing. The directory /usr/bin is managed by the package manager, APT (as in apt-get and apt), so you will never need to manually make changes to it. You're not alone though. Lots of folks make changes to the system Python setup without realizing that most of the GUI depends on it.

Now, how can you fix this?

  1. Access a TTY. See What is a tty, and how do I access a tty?
  2. Put python3.6 back, cause the system depends on it (via /usr/bin/python3, which is a symlink to python3.6)

    sudo mv /usr/bin/python /usr/bin/python3.6
  3. Either reinstall python2.7

    sudo apt-get install --reinstall python2.7-minimal

    or remove it

    sudo apt-get remove python2.7
  4. Either figure out another way to set Python 3 as the default (see How to make 'python' program command execute Python 3?), or learn to live with typing python3 every time.

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.