Thursday, April 14, 2016

python - GNOME terminal not opening in Ubuntu 18.04




I upgraded my python to 3.7.1 from 3.6 since then I am not able to open my GNOME terminal. I reinstalled gnome-terminal.
Using the command



sudo apt-get remove gnome-terminal && sudo apt-get install gnome-terminal


But it is not opening. Ctrl + Alt + T is also not working.



I opened Xterm and typed "gnome-terminal".




I got this error



Cannot import name '_gi' from 'gi'(/usr/lib/python3/dist-packages/gi/__init__.py)


Screenshot of error:



Screenshot



Output of ls -l /usr/bin/python3:




ls: cannot access '/usr/bin/python3': No such file or directory


I'm getting errors in apt commands also:



0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. 
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up iotop (0.6-2) ... /var/lib/dpkg/info/iotop.postinst: 6: /var/lib/dpkg/info/iotop.postinst: py3compile: not found dpkg: error processing package iotop (--configure): installed iotop package post-installation script subprocess returned error exit status 127

Errors were encountered while processing: iotop
E: Sub-process /usr/bin/dpkg returned an error code (1)


By updating alternatives, you've set Python 3 as default even when python is called. This may break some packages. So, it's better to use aliases as far as python is considered. Roll back the change you made:



sudo update-alternatives --install /usr/bin/python python /usr/bin/python2
sudo update-alternatives --config python



and choose python2. python is always used to call Python 2 and python3 to call Python 3.



GNOME terminal depends on default version of Python 3 (here 3.6). In your installation GNOME terminal was trying to run with Python 2 which will obviously not satisfy its dependency. So, modify the very first line of /usr/bin/gnome-terminal and change it to:



#!/usr/bin/python3


Now, in your installation python3 wasn't in /usr/bin/ and py3compile wasn't found, they can be restored by reinstalling python3-minimal:



sudo apt install --reinstall python-minimal


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...