当我在解释器中输入“from gi.repository import Gtk”时,我得到
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gi.repository
这是我的酿造清单
at-spi2-atk freetype gtk+ libffi py2cairo
at-spi2-core gdbm gtk+3 libpng pygobject
atk gdk-pixbuf harfbuzz libtiff pygtk
cairo gettext icu4c pango readline
d-bus glib intltool pixman sqlite
fontconfig gstreamer jpeg pkg-config xz
以及python中“print sys.path”的结果
['', '/Library/Python/2.7/site-packages/setuptools-1.1.5-py2.7.egg', '/Library/Python/2.7/site-packages/py2app-0.7.3-py2.7.egg', '/Library/Python/2.7/site-packages/macholib-1.5.1-py2.7.egg', '/Library/Python/2.7/site-packages/modulegraph-0.10.4-py2.7.egg', '/Library/Python/2.7/site-packages/altgraph-0.10.2-py2.7.egg', '/usr/local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages/gobject', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/Library/Python/2.7/site-packages', '/usr/local/lib/python2.7/site-packages/gtk-2.0']
我自制模块的站点包似乎在 python 路径中,所以我不知道我缺少什么。我正在使用我的 System/Library/Frameworks 目录中的 python 2.7.5(在 Mountain Lion 上)。我曾尝试酿造 python(2 和 3)来尝试解决这个问题,但安装停止,python 以 100% cpu 运行并且从未完成。
提前感谢您提供的任何建议。