'How to correctly install pyGTK using macports?

My python code uses GTK for some GUI and now i need to run some of it on OSX (10.6 Snow Leopard and 10.7 Lion). Unfortunately, unofficial pyGTK build crashes on window GTK windows resize, so i decided to test macports version. I installed python and pygtk via following macports commands:

sudo port install python26
sudo port select --set python python26
sudo port install py-gtk2

Running python from console correctly starts macports version of python. But trying to execute import gtk or import pygtk fails with error that such package is not available :(.

I have a feeling that I missed something very simple to get all to work. Something like setting correct site-package for macports python or whatever. Maybe some guru may share a bit of wisdom?

UPDATE: Careful examination revealed that py-gtk2 was installed only into /opt/local/lib/python2.4/site-packages, leaving .../python2.6/site-packages and .../python2.7/site-packages blank. Running macports version of python 2.4 allows me to use pyGTK. But I want it with python 2.6 (preferred) or 2.7 :(.



Solution 1:[1]

Only py27-pygtk is valid macport now

sudo port install py27-pygtk

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Manyam Nandeesh Reddy