Page 1 of 1

Import Error: No module named pygtk

Posted: Sat Jun 30, 2012 8:44 pm
by hrgdavid
Hi,

I'm new to Python and am presumably making a basic error, but this has had me occupied all afternoon and evening trying to google an answer without success. Please help ;-)

I've copied a simple program from the web to put a window up on the screen. The first line is "Import pygtk". When I run it it returns "Import Error: No module named pygtk".

I've also tried this interactively in LXTerminal - same result. And the same thing happens with "Import gtk".

Do I need to do something first to install these modules ? I thought it was part of the standard Python install....?

Thanks for any help.
Regards,
David L.

Re: Import Error: No module named pygtk

Posted: Sun Jul 01, 2012 8:32 am
by andyl
You need to install pygtk.

Not every Python module in the world is installed by default.

Code: Select all

sudo apt-get install python-gtk2
You may want to install the doc package too.

Re: Import Error: No module named pygtk

Posted: Sun Jul 01, 2012 11:06 am
by hrgdavid
andyl wrote:You need to install pygtk.

Not every Python module in the world is installed by default.

Code: Select all

sudo apt-get install python-gtk2
You may want to install the doc package too.
Andy, you're a star ! Thank you.

Re: Import Error: No module named pygtk

Posted: Mon Nov 05, 2012 5:53 am
by kibr3
That helped me too .Thanks

Re: Import Error: No module named pygtk

Posted: Wed Aug 21, 2013 9:26 am
by sisila
thank you........ :o

Re: Import Error: No module named pygtk

Posted: Fri Feb 13, 2015 7:50 pm
by jander2099
Yes!!! Thank you so much! That fixed it.

Re: Import Error: No module named pygtk

Posted: Thu Sep 14, 2017 9:10 am
by paulwratt
fix still works (2017)

Re: Import Error: No module named pygtk

Posted: Thu Sep 14, 2017 10:23 am
by PeterO
importing PyGTK is the old python interface to Gtk+

You might find this useful for doing it the modern way ! http://www.peteronion.org.uk/PyGobjectGtk+3/PyGtk.html

HTH

PeterO