How to correctly install pyGTK using macports?

随声附和 提交于 2019-12-10 18:05:35

问题


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 :(.


回答1:


Port name was incorrect. Correct ports are py25-gtk / py26-gtk / py27-gtk.

Updated: recently renamed to py25-pygtk / py26-pygtk / py27-pygtk



来源:https://stackoverflow.com/questions/7317921/how-to-correctly-install-pygtk-using-macports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!