Python3:命名空间AppIndicator3不可用

问题描述

操作系统:Kubuntu 18.04

我有一个Python程序(program.py),其开头是这样的:

import shlex
import sys
import notify2
import os
import gi

gi.require_version("Gtk","3.0")
from gi.repository import Gtk

gi.require_version("AppIndicator3","0.1")
from gi.repository import AppIndicator3

运行它时,会发生以下情况:

$ python3 /path/to/program.py 
Traceback (most recent call last):
  File "/path/to/program.py",line 34,in <module>
    gi.require_version('AppIndicator3','0.1')
  File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.8.5/lib/python3.8/site-packages/gi/__init__.py",line 129,in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace AppIndicator3 not available

相关信息:

$ python3 --version
Python 3.8.5

$ pip3 freeze
dbus-python==1.2.16
docutils==0.16
formiko==1.4.3
libxml2-python==2.9.10
meson==0.55.1
notify2==0.3.1
pycairo==1.19.1
PyGObject==3.36.1

$ brew install gobject-introspection
Warning: gobject-introspection 1.64.1_2 is already installed and up-to-date
To reinstall 1.64.1_2,run `brew reinstall gobject-introspection`

我还安装了以下软件:

libappindicator3-1 is already the newest version (12.10.1+18.04.20180322.1-0ubuntu1).
gir1.2-appindicator3-0.1 is already the newest version (12.10.1+18.04.20180322.1-0ubuntu1).
python3-gi is already the newest version (3.26.1-2ubuntu1).

是什么导致无法找到AppIndicator3?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)