【问题标题】:Ubuntu - Anaconda 2020.02 - Namespace Gtk not availableUbuntu - Anaconda 2020.02 - 命名空间 Gtk 不可用
【发布时间】:2020-05-13 15:46:27
【问题描述】:

这是在 Ubuntu 16.04 LTS 上。

我遇到了和这个问题一样的问题:

ValueError: Namespace Gtk not available

我为 gtk3 做了以下设置

conda install -c conda-forge pygobject
sudo apt-get install libgtk-3-dev
sudo apt install python3-gi gobject-introspection gir1.2-gtk-3.0

然而,简单的测试程序在:

https://python-gtk-3-tutorial.readthedocs.io/en/latest/introduction.html

失败,同样的错误:

Python 3.7.7 (default, Mar 26 2020, 15:48:22) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version("Gtk", "3.0")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/me/anaconda3/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

还有其他可以尝试的解决方案吗?

这是全新安装的 Anaconda (Anaconda3-2020.02-Linux-x86_64.sh);安装后进行了 conda update --all 。但我想知道可能出了什么问题。

【问题讨论】:

  • 试试conda install -c conda-forge gtk3
  • 成功了;发布作为答案,以获得信用:-)。

标签: python anaconda gtk pygtk conda-forge


【解决方案1】:

在 conda-forge 上有一个 gtk3 包:

conda install -c conda-forge gtk3

【讨论】:

    猜你喜欢
    • 2019-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-14
    • 1970-01-01
    相关资源
    最近更新 更多