23

I have upgraded python to version 3.7 and now my terminal is not opening up.

I followed this post https://jcutrer.com/linux/upgrade-python37-ubuntu1810

Commands I ran are as follows,

sudo apt-get install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
sudo update-alternatives --config python3

Entered 2 for python3.7

I can't open terminal and run commands.

My ubuntu version is, Ubuntu 18.04.2 LTS

1

2 Answers 2

45

This way the upgrade to 3.7 is useless. You should edit the gnome-terminal file:

Open a tty shell with Ctrl+Alt+F3(F2 to close it). Login with your credentials and issue the following command:

sudo nano /usr/bin/gnome-terminal

Change #!/usr/bin/python3 to #!/usr/bin/python3.6.

This way you can still use the power of 3.7 and solve the issue with the terminal.

5
  • 1
    Will this change be overriden when gnome-terminal is updated in the future?
    – Daniel
    Commented Apr 30, 2020 at 16:06
  • 1
    These are terminal commands. How am I supposed to enter these if terminal will not open? Commented Dec 28, 2020 at 13:36
  • 1
    @crashspringfield xterm should be available. Or you can switch to a TTY
    – muru
    Commented Mar 17, 2022 at 6:38
  • this answer worked for me, basically updating gnome-terminal to import a new library stackoverflow.com/a/60352723/2011798 Commented Aug 24, 2022 at 0:45
  • 2
    This fix did not work for Python 3.10 for me. I had to use Python3.8 instead. Commented Nov 16, 2022 at 14:31
17

I ran the command

sudo update-alternatives --config python3

Entered 1

I got my terminal back.

Still wonder why it wasn't working with python3.7.1 though.

To get access to command line if terminal is not opening up try the below shortcuts to run commands on a virtual terminal or refer to how-to-access-bash-without-a-terminal-emulator

Ctrl+Alt+(F1 through F4 at least, maybe up to F6) run a terminal interface on the virtual consoles. Once there, to get back to the GUI, use Ctrl+Alt+F7.

2
  • Answers to this question may help explain this.
    – davidbak
    Commented Jul 15, 2019 at 16:44
  • fixing the gnome-terminal seems much better. I'd suggest to remove this answer and accept the one that fixes the terminal. Commented Dec 28, 2019 at 7:26

Not the answer you're looking for? Browse other questions tagged .