I have updated my computer from Ubuntu 18.04 to 20.04. During the update, may be I accidentally deleted some file when some pop-up appeared. I accepted this ubuntu ask to replace config file. And chose remove ubuntu ask for remove obsolete package I looked at the list of the file but it's too strange and the OS tells me that they are old.
When I am on the new OS, I cannot open terminal by clicking the icon or using Ctrl+Alt+T. I can only open it by clicking 'open in terminal' in nautilus. I tried opening terminal by typing gnome-terminal
but there's an error:
Traceback (most recent call last):
File "/usr/bin/gnome-terminal", line 9, in <module>
from gi.repository import GLib, Gio
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
from . import _gi
ImportError: cannot import name '_gi'
I searched and found this topic on askubuntu. I followed the accepted answer but that didn't help. I also tried the second best answer and the result is the same. I think its because I am missing those _gi.cpython-35m-x86_64-linux-gnu.so
and _gi_cairo.cpython-35m-x86_64-linux-gnu.so
files. I have already installed python3.6 and python3.5 ?
Someone in the comment suggests that apt_pkg
is missing. And I ran sudo apt-get update
to check and found an error message: ImportError: No module named 'apt_pkg'
.
Again I started searching on askubuntu. I tried some solutions and realized the folder /usr/lib/python3/dist-packages/gi/
contains only _gi_cairo.cpython-38-x86_64-linux-gnu.so
and _gi_cairo.cpython-38-x86_64-linux-gnu.so
files. So I coppied it into apt_pkg
. Now, the error from apt-get update
is resolved, however I still cannot open terminal in both the earlier methods I described.
I have tried every solution I can find on stackoverflow but it still won't help. The last solution I can think of is reinstalling the OS. Thanks in advance for any help.