Aumentar a verbosidade do intérprete é um longo caminho para a triagem desse problema. Mesmo depois de tudo isso, eu tentei fazer um simples link simbólico do pacote dist-2.7 para o meu pacote dist do usr / local 3.x e fiquei um pouco mais longe, mas não muito.
sudo ln -s /usr/lib/python2.7/dist-packages/gi/ /usr/local/lib/python3.2/dist-packages
~$ python3
Python 3.2.2+ (default, Feb 16 2012, 19:05:44)
[GCC 4.6.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.2/dist-packages/gi/__init__.py", line 23, in
from ._gi import _API, Repository
ImportError: /usr/lib/libpyglib-gi-2.0-python2.7.so.0: undefined symbol: _Py_ZeroStruct
Se você puder rastrear o símbolo ausente, poderá resolver esse problema.
Aqui está toda a saída de importação detalhada que me levou até aqui. Além disso, isso parece relevante: link , boa sorte.
>>> import gi
# trying gi.cpython-32mu.so
# trying gimodule.cpython-32mu.so
# trying gi.abi3.so
# trying gimodule.abi3.so
# trying gi.so
# trying gimodule.so
# trying gi.py
# trying gi.pyc
# trying /usr/lib/python3.2/gi.cpython-32mu.so
# trying /usr/lib/python3.2/gimodule.cpython-32mu.so
# trying /usr/lib/python3.2/gi.abi3.so
# trying /usr/lib/python3.2/gimodule.abi3.so
# trying /usr/lib/python3.2/gi.so
# trying /usr/lib/python3.2/gimodule.so
# trying /usr/lib/python3.2/gi.py
# trying /usr/lib/python3.2/gi.pyc
# trying /usr/lib/python3.2/plat-linux2/gi.cpython-32mu.so
# trying /usr/lib/python3.2/plat-linux2/gimodule.cpython-32mu.so
# trying /usr/lib/python3.2/plat-linux2/gi.abi3.so
# trying /usr/lib/python3.2/plat-linux2/gimodule.abi3.so
# trying /usr/lib/python3.2/plat-linux2/gi.so
# trying /usr/lib/python3.2/plat-linux2/gimodule.so
# trying /usr/lib/python3.2/plat-linux2/gi.py
# trying /usr/lib/python3.2/plat-linux2/gi.pyc
# trying /usr/lib/python3.2/lib-dynload/gi.cpython-32mu.so
# trying /usr/lib/python3.2/lib-dynload/gimodule.cpython-32mu.so
# trying /usr/lib/python3.2/lib-dynload/gi.abi3.so
# trying /usr/lib/python3.2/lib-dynload/gimodule.abi3.so
# trying /usr/lib/python3.2/lib-dynload/gi.so
# trying /usr/lib/python3.2/lib-dynload/gimodule.so
# trying /usr/lib/python3.2/lib-dynload/gi.py
# trying /usr/lib/python3.2/lib-dynload/gi.pyc
# trying /usr/local/lib/python3.2/dist-packages/gi.cpython-32mu.so
# trying /usr/local/lib/python3.2/dist-packages/gimodule.cpython-32mu.so
# trying /usr/local/lib/python3.2/dist-packages/gi.abi3.so
# trying /usr/local/lib/python3.2/dist-packages/gimodule.abi3.so
# trying /usr/local/lib/python3.2/dist-packages/gi.so
# trying /usr/local/lib/python3.2/dist-packages/gimodule.so
# trying /usr/local/lib/python3.2/dist-packages/gi.py
# trying /usr/local/lib/python3.2/dist-packages/gi.pyc
# trying /usr/lib/python3/dist-packages/gi.cpython-32mu.so
# trying /usr/lib/python3/dist-packages/gimodule.cpython-32mu.so
# trying /usr/lib/python3/dist-packages/gi.abi3.so
# trying /usr/lib/python3/dist-packages/gimodule.abi3.so
# trying /usr/lib/python3/dist-packages/gi.so
# trying /usr/lib/python3/dist-packages/gimodule.so
# trying /usr/lib/python3/dist-packages/gi.py
# trying /usr/lib/python3/dist-packages/gi.pyc
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named gi
O caminho de pesquisa nem sequer olha para o caminho python2.7.
Aqui está como parece do lado bem-sucedido do python2.7.
>>> import gi
# trying gi.so
# trying gimodule.so
# trying gi.py
# trying gi.pyc
# trying /usr/lib/python2.7/gi.so
# trying /usr/lib/python2.7/gimodule.so
# trying /usr/lib/python2.7/gi.py
# trying /usr/lib/python2.7/gi.pyc
# trying /usr/lib/python2.7/plat-linux2/gi.so
# trying /usr/lib/python2.7/plat-linux2/gimodule.so
# trying /usr/lib/python2.7/plat-linux2/gi.py
# trying /usr/lib/python2.7/plat-linux2/gi.pyc
# trying /usr/lib/python2.7/lib-tk/gi.so
# trying /usr/lib/python2.7/lib-tk/gimodule.so
# trying /usr/lib/python2.7/lib-tk/gi.py
# trying /usr/lib/python2.7/lib-tk/gi.pyc
# trying /usr/lib/python2.7/lib-dynload/gi.so
# trying /usr/lib/python2.7/lib-dynload/gimodule.so
# trying /usr/lib/python2.7/lib-dynload/gi.py
# trying /usr/lib/python2.7/lib-dynload/gi.pyc
# trying /usr/local/lib/python2.7/dist-packages/gi.so
# trying /usr/local/lib/python2.7/dist-packages/gimodule.so
# trying /usr/local/lib/python2.7/dist-packages/gi.py
# trying /usr/local/lib/python2.7/dist-packages/gi.pyc
import gi # directory /usr/lib/python2.7/dist-packages/gi
# trying /usr/lib/python2.7/dist-packages/gi/__init__.so
# trying /usr/lib/python2.7/dist-packages/gi/__init__module.so
# trying /usr/lib/python2.7/dist-packages/gi/__init__.py
# /usr/lib/python2.7/dist-packages/gi/__init__.pyc matches /usr/lib/python2.7/dist-packages/gi/__init__.py
import gi # precompiled from /usr/lib/python2.7/dist-packages/gi/__init__.pyc
# trying __future__.so
# trying __future__module.so
# trying __future__.py
# trying __future__.pyc
# trying /usr/lib/python2.7/__future__.so
# trying /usr/lib/python2.7/__future__module.so
# trying /usr/lib/python2.7/__future__.py
# /usr/lib/python2.7/__future__.pyc matches /usr/lib/python2.7/__future__.py
import __future__ # precompiled from /usr/lib/python2.7/__future__.pyc
# trying /usr/lib/python2.7/dist-packages/gi/_gi.so
dlopen("/usr/lib/python2.7/dist-packages/gi/_gi.so", 2);
import gi._gobject # directory /usr/lib/python2.7/dist-packages/gi/_gobject
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/__init__.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/__init__module.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/__init__.py
# /usr/lib/python2.7/dist-packages/gi/_gobject/__init__.pyc matches /usr/lib/python2.7/dist-packages/gi/_gobject/__init__.py
import gi._gobject # precompiled from /usr/lib/python2.7/dist-packages/gi/_gobject/__init__.pyc
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/sys.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/sysmodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/sys.py
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/sys.pyc
import gi._glib # directory /usr/lib/python2.7/dist-packages/gi/_glib
# trying /usr/lib/python2.7/dist-packages/gi/_glib/__init__.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/__init__module.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/__init__.py
# /usr/lib/python2.7/dist-packages/gi/_glib/__init__.pyc matches /usr/lib/python2.7/dist-packages/gi/_glib/__init__.py
import gi._glib # precompiled from /usr/lib/python2.7/dist-packages/gi/_glib/__init__.pyc
# trying /usr/lib/python2.7/dist-packages/gi/_glib/_glib.so
dlopen("/usr/lib/python2.7/dist-packages/gi/_glib/_glib.so", 2);
import gi._glib._glib # dynamically loaded from /usr/lib/python2.7/dist-packages/gi/_glib/_glib.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/option.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/optionmodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/option.py
# /usr/lib/python2.7/dist-packages/gi/_glib/option.pyc matches /usr/lib/python2.7/dist-packages/gi/_glib/option.py
import gi._glib.option # precompiled from /usr/lib/python2.7/dist-packages/gi/_glib/option.pyc
# trying /usr/lib/python2.7/dist-packages/gi/_glib/sys.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/sysmodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/sys.py
# trying /usr/lib/python2.7/dist-packages/gi/_glib/sys.pyc
# trying /usr/lib/python2.7/dist-packages/gi/_glib/optparse.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/optparsemodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/optparse.py
# trying /usr/lib/python2.7/dist-packages/gi/_glib/optparse.pyc
# trying optparse.so
# trying optparsemodule.so
# trying optparse.py
# trying optparse.pyc
# trying /usr/lib/python2.7/optparse.so
# trying /usr/lib/python2.7/optparsemodule.so
# trying /usr/lib/python2.7/optparse.py
# /usr/lib/python2.7/optparse.pyc matches /usr/lib/python2.7/optparse.py
import optparse # precompiled from /usr/lib/python2.7/optparse.pyc
# trying textwrap.so
# trying textwrapmodule.so
# trying textwrap.py
# trying textwrap.pyc
# trying /usr/lib/python2.7/textwrap.so
# trying /usr/lib/python2.7/textwrapmodule.so
# trying /usr/lib/python2.7/textwrap.py
# /usr/lib/python2.7/textwrap.pyc matches /usr/lib/python2.7/textwrap.py
import textwrap # precompiled from /usr/lib/python2.7/textwrap.pyc
# trying string.so
# trying stringmodule.so
# trying string.py
# trying string.pyc
# trying /usr/lib/python2.7/string.so
# trying /usr/lib/python2.7/stringmodule.so
# trying /usr/lib/python2.7/string.py
# /usr/lib/python2.7/string.pyc matches /usr/lib/python2.7/string.py
import string # precompiled from /usr/lib/python2.7/string.pyc
import strop # builtin
# trying gettext.so
# trying gettextmodule.so
# trying gettext.py
# trying gettext.pyc
# trying /usr/lib/python2.7/gettext.so
# trying /usr/lib/python2.7/gettextmodule.so
# trying /usr/lib/python2.7/gettext.py
# /usr/lib/python2.7/gettext.pyc matches /usr/lib/python2.7/gettext.py
import gettext # precompiled from /usr/lib/python2.7/gettext.pyc
# trying locale.so
# trying localemodule.so
# trying locale.py
# trying locale.pyc
# trying /usr/lib/python2.7/locale.so
# trying /usr/lib/python2.7/localemodule.so
# trying /usr/lib/python2.7/locale.py
# /usr/lib/python2.7/locale.pyc matches /usr/lib/python2.7/locale.py
import locale # precompiled from /usr/lib/python2.7/locale.pyc
import operator # builtin
# trying functools.so
# trying functoolsmodule.so
# trying functools.py
# trying functools.pyc
# trying /usr/lib/python2.7/functools.so
# trying /usr/lib/python2.7/functoolsmodule.so
# trying /usr/lib/python2.7/functools.py
# /usr/lib/python2.7/functools.pyc matches /usr/lib/python2.7/functools.py
import functools # precompiled from /usr/lib/python2.7/functools.pyc
import _functools # builtin
import _locale # builtin
# trying copy.so
# trying copymodule.so
# trying copy.py
# trying copy.pyc
# trying /usr/lib/python2.7/copy.so
# trying /usr/lib/python2.7/copymodule.so
# trying /usr/lib/python2.7/copy.py
# /usr/lib/python2.7/copy.pyc matches /usr/lib/python2.7/copy.py
import copy # precompiled from /usr/lib/python2.7/copy.pyc
# trying weakref.so
# trying weakrefmodule.so
# trying weakref.py
# trying weakref.pyc
# trying /usr/lib/python2.7/weakref.so
# trying /usr/lib/python2.7/weakrefmodule.so
# trying /usr/lib/python2.7/weakref.py
# /usr/lib/python2.7/weakref.pyc matches /usr/lib/python2.7/weakref.py
import weakref # precompiled from /usr/lib/python2.7/weakref.pyc
# trying org.so
# trying orgmodule.so
# trying org.py
# trying org.pyc
# trying /usr/lib/python2.7/org.so
# trying /usr/lib/python2.7/orgmodule.so
# trying /usr/lib/python2.7/org.py
# trying /usr/lib/python2.7/org.pyc
# trying /usr/lib/python2.7/plat-linux2/org.so
# trying /usr/lib/python2.7/plat-linux2/orgmodule.so
# trying /usr/lib/python2.7/plat-linux2/org.py
# trying /usr/lib/python2.7/plat-linux2/org.pyc
# trying /usr/lib/python2.7/lib-tk/org.so
# trying /usr/lib/python2.7/lib-tk/orgmodule.so
# trying /usr/lib/python2.7/lib-tk/org.py
# trying /usr/lib/python2.7/lib-tk/org.pyc
# trying /usr/lib/python2.7/lib-dynload/org.so
# trying /usr/lib/python2.7/lib-dynload/orgmodule.so
# trying /usr/lib/python2.7/lib-dynload/org.py
# trying /usr/lib/python2.7/lib-dynload/org.pyc
# trying /usr/local/lib/python2.7/dist-packages/org.so
# trying /usr/local/lib/python2.7/dist-packages/orgmodule.so
# trying /usr/local/lib/python2.7/dist-packages/org.py
# trying /usr/local/lib/python2.7/dist-packages/org.pyc
# trying /usr/lib/python2.7/dist-packages/org.so
# trying /usr/lib/python2.7/dist-packages/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/org.py
# trying /usr/lib/python2.7/dist-packages/org.pyc
# trying /usr/lib/python2.7/dist-packages/PIL/org.so
# trying /usr/lib/python2.7/dist-packages/PIL/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/PIL/org.py
# trying /usr/lib/python2.7/dist-packages/PIL/org.pyc
# trying /usr/lib/python2.7/dist-packages/gst-0.10/org.so
# trying /usr/lib/python2.7/dist-packages/gst-0.10/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/gst-0.10/org.py
# trying /usr/lib/python2.7/dist-packages/gst-0.10/org.pyc
# trying /usr/lib/python2.7/dist-packages/gtk-2.0/org.so
# trying /usr/lib/python2.7/dist-packages/gtk-2.0/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/gtk-2.0/org.py
# trying /usr/lib/python2.7/dist-packages/gtk-2.0/org.pyc
# trying /usr/lib/pymodules/python2.7/org.so
# trying /usr/lib/pymodules/python2.7/orgmodule.so
# trying /usr/lib/pymodules/python2.7/org.py
# trying /usr/lib/pymodules/python2.7/org.pyc
# trying /usr/lib/python2.7/dist-packages/ubuntu-sso-client/org.so
# trying /usr/lib/python2.7/dist-packages/ubuntu-sso-client/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/ubuntu-sso-client/org.py
# trying /usr/lib/python2.7/dist-packages/ubuntu-sso-client/org.pyc
# trying /usr/lib/python2.7/dist-packages/ubuntuone-client/org.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-client/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-client/org.py
# trying /usr/lib/python2.7/dist-packages/ubuntuone-client/org.pyc
# trying /usr/lib/python2.7/dist-packages/ubuntuone-control-panel/org.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-control-panel/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-control-panel/org.py
# trying /usr/lib/python2.7/dist-packages/ubuntuone-control-panel/org.pyc
# trying /usr/lib/python2.7/dist-packages/ubuntuone-couch/org.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-couch/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-couch/org.py
# trying /usr/lib/python2.7/dist-packages/ubuntuone-couch/org.pyc
# trying /usr/lib/python2.7/dist-packages/ubuntuone-installer/org.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-installer/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-installer/org.py
# trying /usr/lib/python2.7/dist-packages/ubuntuone-installer/org.pyc
# trying /usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol/org.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol/orgmodule.so
# trying /usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol/org.py
# trying /usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol/org.pyc
# trying struct.so
# trying structmodule.so
# trying struct.py
# trying struct.pyc
# trying /usr/lib/python2.7/struct.so
# trying /usr/lib/python2.7/structmodule.so
# trying /usr/lib/python2.7/struct.py
# /usr/lib/python2.7/struct.pyc matches /usr/lib/python2.7/struct.py
import struct # precompiled from /usr/lib/python2.7/struct.pyc
import _struct # builtin
# trying /usr/lib/python2.7/dist-packages/gi/_glib/gi.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/gimodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_glib/gi.py
# trying /usr/lib/python2.7/dist-packages/gi/_glib/gi.pyc
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/constants.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/constantsmodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/constants.py
# /usr/lib/python2.7/dist-packages/gi/_gobject/constants.pyc matches /usr/lib/python2.7/dist-packages/gi/_gobject/constants.py
import gi._gobject.constants # precompiled from /usr/lib/python2.7/dist-packages/gi/_gobject/constants.pyc
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/_gobject.so
dlopen("/usr/lib/python2.7/dist-packages/gi/_gobject/_gobject.so", 2);
import gi._gobject._gobject # dynamically loaded from /usr/lib/python2.7/dist-packages/gi/_gobject/_gobject.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelpermodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.py
# /usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyc matches /usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.py
import gi._gobject.propertyhelper # precompiled from /usr/lib/python2.7/dist-packages/gi/_gobject/propertyhelper.pyc
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/GTypeWrapper.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/GTypeWrappermodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/GTypeWrapper.py
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/GTypeWrapper.pyc
# trying datetime.so
# trying datetimemodule.so
# trying datetime.py
# trying datetime.pyc
# trying /usr/lib/python2.7/datetime.so
# trying /usr/lib/python2.7/datetimemodule.so
# trying /usr/lib/python2.7/datetime.py
# trying /usr/lib/python2.7/datetime.pyc
# trying /usr/lib/python2.7/plat-linux2/datetime.so
# trying /usr/lib/python2.7/plat-linux2/datetimemodule.so
# trying /usr/lib/python2.7/plat-linux2/datetime.py
# trying /usr/lib/python2.7/plat-linux2/datetime.pyc
# trying /usr/lib/python2.7/lib-tk/datetime.so
# trying /usr/lib/python2.7/lib-tk/datetimemodule.so
# trying /usr/lib/python2.7/lib-tk/datetime.py
# trying /usr/lib/python2.7/lib-tk/datetime.pyc
# trying /usr/lib/python2.7/lib-dynload/datetime.so
dlopen("/usr/lib/python2.7/lib-dynload/datetime.so", 2);
import datetime # dynamically loaded from /usr/lib/python2.7/lib-dynload/datetime.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/GTypeWrapper.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/GTypeWrappermodule.so
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/GTypeWrapper.py
# trying /usr/lib/python2.7/dist-packages/gi/_gobject/GTypeWrapper.pyc
import gi._gi # dynamically loaded from /usr/lib/python2.7/dist-packages/gi/_gi.so