close

[Solved] Cannot import name ‘_gi’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Cannot import name ‘_gi’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Cannot import name ‘_gi’ Error Occurs?

Today I get the following error Cannot import name ‘_gi’ in python.

How To Solve Cannot import name ‘_gi’ Error ?

  1. How To Solve Cannot import name '_gi' Error ?

    To Solve Cannot import name '_gi' Error Ubuntu does not like to switch its default interpreter away from python 3.7.

  2. Cannot import name '_gi'

    To Solve Cannot import name '_gi' Error Ubuntu does not like to switch its default interpreter away from python 3.7.

Solution 1

Ubuntu does not like to switch its default interpreter away from python 3.7.

So switch it back to 3.6 by using

sudo update-alternatives --config python3

After that try to install the gi package:

sudo apt install python3-gi

Solution 2

I found that the solution is:

sudo ln -s /usr/lib/python3/dist-packages/gi/_gi.cpython-{36m,37m}-x86_64-linux-gnu.so

This worked for me with Python 3.7 on Ubuntu.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read