Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python finds glib, but not _glib

Tags:

python

glib

I try to import glib in Python (2.7) and get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/share/pyshared/glib/__init__.py", line 22, in <module>
    from glib._glib import *
ImportError: No module named _glib

Seems as if glib is found, while _glib is not found.

Has anybody a hint for solving this problem? I'm running Ubuntu and installed python2.7, python-gobject, python-gda, dbus from Ubuntu's package manager.

like image 772
phimuemue Avatar asked Jun 24 '26 09:06

phimuemue


1 Answers

I had this issue.

You can try moving the glib and related folders out of the python2.7 install locations e.g. on ubuntu /usr/shared/pyshared in case these have been installed wrongly.

Then remove and reinstalling the related packages with the platform package manager ...

sudo apt-get remove followed by sudo apt-get install

for ...

python-gobject python-gtk libglib2.0-dev python-cario python-gi

since if they are present in pyshared I found that they were not probably reinstalled

like image 146
user1998576 Avatar answered Jun 25 '26 22:06

user1998576



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!