【发布时间】:2015-07-01 02:48:37
【问题描述】:
当尝试使用from gi.repository import glib 在 python 3 中导入 glib 时,我收到一条错误消息:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2135, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/gi/importer.py", line 53, in find_module
'introspection typelib not found' % namespace)
ImportError: cannot import name glib, introspection typelib not found
我在 Ubuntu 14.04 上使用 apt-get 安装了所有 python glib/dev 包。尝试在 python 2 中导入模块表示该模块不存在。
我该如何解决这个问题?
【问题讨论】:
-
你能展示你的代码吗?
-
一到导入语句就会抛出一个错误。我试过使用交互式解释器,这就是它抛出错误的地方。
-
有趣。请问你是怎么安装glib的?
标签: python python-3.x importerror glib traceback