-1

Earlier, my default Python version was python2.7.

To upgrade it, I deleted python from /usr/bin/ and renamed python3.6 as python in the same directory.

Afterwards, my terminal stopped working.

It gets no response on opening it.

1 Answers1

4

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 (warning OP is using Ubuntu 18.10, which does not rely on python-2.7 by default. If you're using a different version, don't do this)

    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.
wjandrea
  • 14,504