首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python3:命名空间AppIndicator3不可用

Python3:命名空间AppIndicator3不可用
EN

Stack Overflow用户
提问于 2020-08-28 16:30:18
回答 1查看 744关注 0票数 0

操作系统: Kubuntu 18.04

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

代码语言:javascript
复制
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

当我运行它时,会发生这样的情况:

代码语言:javascript
复制
$ 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/python@3.8/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

相关信息:

代码语言:javascript
复制
$ 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`

我还安装了以下软件:

代码语言:javascript
复制
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被发现?

EN

回答 1

Stack Overflow用户

发布于 2020-09-23 22:07:53

尝试删除第9行并直接导入它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63630190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档