我尝试安装几个 python nautilus 扩展(例如 nautilus-columns、nautilus-open-as-root 等),但没有成功。安装顺利,但 nautilus 中没有显示任何内容。
当然,python-nautilus 包已经安装:
ii python-nautilus 1.1-8 amd64 Python binding for Nautilus components
稍微挖掘一下,我发现 nautilus 在启动时发出了抱怨:
ImportError: could not import gobject (could not find _PyGObject_API object)
(nautilus:18199): Nautilus-Python-WARNING **: pygobject initialization failed
(nautilus:18199): Nautilus-Python-WARNING **: nautilus_python_init_python failed
看起来像是 gobject 库或类似的东西的问题。
由于我运行的是 Ubuntu 14.04.5,并且已升级 Python,因此可能存在问题?以下是我发行版上可用的一些软件包的摘录:
ii libpython-stdlib:amd64 2.7.5-5ubuntu3 amd64 interactive high-level object-oriented language (default python version)
ii libpython2.7-stdlib:amd64 2.7.6-8ubuntu0.2 amd64 Interactive high-level object-oriented language (standard library, version 2.7)
ii libpython3-stdlib:amd64 3.4.0-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii libpython3.4-stdlib:amd64 3.4.3-1ubuntu1~14.04.4 amd64 Interactive high-level object-oriented language (standard library, version 3.4)
ii python 2.7.5-5ubuntu3 amd64 interactive high-level object-oriented language (default version)
ii python-gi 3.12.0-1ubuntu1 amd64 Python 2.x bindings for gobject-introspection libraries
ii python-gobject 3.12.0-1ubuntu1 all Python 2.x bindings for GObject - transitional package
ii python-gobject-2 2.28.6-12build1 amd64 deprecated static Python bindings for the GObject library
ii python2.7 2.7.6-8ubuntu0.2 amd64 Interactive high-level object-oriented language (version 2.7)
ii python3 3.4.0-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii python3-gi 3.12.0-1ubuntu1 amd64 Python 3 bindings for gobject-introspection libraries
ii python3.4 3.4.3-1ubuntu1~14.04.4 amd64 Interactive high-level object-oriented language (version 3.4)
让我对 python 版本 /gobject/v2.7 和 v3.4 产生疑问的还有 python-nautilus README 文件所说的内容:
libautilus-extension Python bindings
====================================
These are unstable bindings for the nautilus extension library
introduced in Gnome 2.6.
For examples and documentation check the examples sub directory.
As of nautilus-python 0.7.0, scripts are also loaded from $XDG_DATA_DIR/nautilus-python/extensions,
which includes ~/.local/share and /usr/share (or whatever your $XDG_DATA_DIR is
set to).
Try to copy test.py to that directory for an example
Requirements
============
Nautilus 2.32.0
Python 2.3
PyGObject 2.28.0
Problems
========
It's currently not possible to reload the python file without
restarting nautilus. That's a planned feature for future versions
=> 看起来很旧,不是吗?
该软件包的最新版本似乎是 0.7.3 (2011-03-08)。这可以解释与 Python 3.4 的一些兼容性问题吗?(链接至项目日志)
如果是,我们该如何继续使用 nautilus 的 python 扩展?是否还有其他软件包需要安装?或者我们可以修改其中的某些内容吗?
有什么建议吗?
谢谢 !