这是我尝试运行的命令及其输出:
$python2
Python 2.7.8 (default, Sep 24 2014, 18:26:21)
[GCC 4.9.1 20140903 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/gi/__init__.py", line 42, in <module>
from . import _gi
ImportError: /usr/lib/python2.7/site-packages/gi/_gi.so: undefined symbol: g_type_check_instance_is_fundamentally_a
我已经搜索了此错误,但是找不到任何有帮助的内容.
这些是我已经安装的软件包:
$pacman -Qs python
local/pygtk 2.24.0-3
Python bindings for the GTK widget set
local/python 3.3.4-1
Next generation of the python high-level scripting language
local/python-dbus-common 1.2.0-2
Common dbus-python files shared between python-dbus and python2-dbus
local/python-gobject 3.14.0-2
Python 3 bindings for GObject
local/python-gobject2 2.28.6-11
Python 3 bindings for GObject2
local/python2 2.7.8-2
A high-level scripting language
local/python2-cairo 1.10.0-1
Python2 bindings for the cairo graphics library
local/python2-dbus 1.2.0-2
Python 2.7 bindings for DBUS
local/python2-distutils-extra 2.38-1
Enhancements to the Python build system
local/python2-gobject 3.14.0-2
Python 2 bindings for GObject
local/python2-gobject2 2.28.6-11
Python 2 bindings for GObject2
local/python2-pillow 2.3.0-3
Python Imaging Library (PIL) fork. Python2 version.
local/python2-xdg 0.25-1
Python library to access freedesktop.org standards
不知道我在这里想念的..
解决了:
错误是由于旧版本的glib2软件包引起的.
解决方法:
这可能不是Python问题,也不是您的代码问题. /usr/lib/python2.7/site-packages/gi/_gi.so可能已损坏或编译错误.也许您把它放错了路.
如何解决:升级glib2
标签:gtk,python 来源: https://codeday.me/bug/20191028/1955678.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。