ImportError: No module named glib

Terry Reedy tjreedy at
Fri Mar 5 18:26:00 CET 2010

On 3/5/2010 3:30 AM, Michael Joachimiak wrote:
> I am too new to python.
> If anybody has an idea what to do please help.
> when I use
> import glib
> in my code I get this:
>>>> import glib
> Traceback (most recent call last):
>    File "<stdin>", line 1, in<module>
> ImportError: No module named glib

glib is not in Python's stdlib so it must be loaded somewhere the 
interpreter can find it. Do

 >>> import sys
 >>> sys.path

and see if it is in any of the listed directories.

Perhaps you need to import pyglib?

Terry Jan Reedy

> :~$ python -V
> Python 2.6.4
> /usr/lib/ exists in version 2.18.0-0ubuntu2
> :~$ pkg-config glib-2.0 --cflags --libs
> -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -lglib-2.0

More information about the Python-list mailing list