3

When following the instructions 2. Getting Started — Python GTK+ 3 Tutorial 3.4 documentation

Tries

In [6]: import gi
   ...: gi.require_version('Gtk', '3.0')
   ...: from gi.repository import Gtk

it report errors:

~/anaconda3/lib/python3.7/site-packages/gi/__init__.py in require_version(namespace, version)
    128     available_versions = repository.enumerate_versions(namespace)
    129     if not available_versions:
--> 130         raise ValueError('Namespace %s not available' % namespace)
    131
    132     if version not in available_versions:

ValueError: Namespace Gtk not available

Follow How do I Install GTK+ 3.0? - Ask Ubuntu and intstalled Gtk to ubuntu

sudo apt-get install libgtk-3-dev

However, it still report the same errors.

How could solve the problem?

Wizard
  • 2,891
  • You have installed another version of python3 and masked system python3. Execute which python3 to know which python3 you used. System python3, which contains gi and Gtk, is located in /usr/bin/python3. – Ping Chu Hung Jul 02 '19 at 09:44
  • yes, after set /usr/bin/python3 as default it report the same error. @PingChuHung – Wizard Jul 02 '19 at 12:07
  • Please update the error message. And append the outputs of dpkg -l | grep libgtk3 and dpkg -l | grep libgtk-3. – Ping Chu Hung Jul 05 '19 at 07:13

1 Answers1

0

I had the same issue but solved it by just making a python virtual environment and then running the command you listed.