При следовании инструкциям 2.Начало работы - документация по Python GTK + 3 Tutorial 3.4
Пытается
In [6]: import gi
...: gi.require_version('Gtk', '3.0')
...: from gi.repository import Gtk
сообщить об ошибках:
~/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
Следуйте Как установить GTK +3,0?- Спросите Ubuntu и вставил Gtk в ubuntu
sudo apt-get install libgtk-3-dev
Однако он по-прежнему сообщает об ошибках.
Как можно решить эту проблему?
Примечание:
Пробовал решение
me@host:~:
$ sudo apt install python3-gi gobject-introspection gir1.2-gtk-3.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
gir1.2-gtk-3.0 is already the newest version (3.24.8-1ubuntu1).
gobject-introspection is already the newest version (1.60.1-1).
python3-gi is already the newest version (3.32.0-1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
me@host:~:
$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[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 130, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available
Установить другие
me@host:~:
$ sudo apt install -y gir1.2-gtk-3.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
gir1.2-gtk-3.0 is already the newest version (3.24.8-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
me@host~:
$ ipython
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import gi
In [2]: gi.require_version('Gtk', '3.0')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-3fc173a88e42> in <module>
----> 1 gi.require_version('Gtk', '3.0')
~/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
Не сработало,
Моя машина:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
Codename: disco
Я столкнулся с проблемой при установке Dropbox в Ubuntu
$ dropbox start
Starting Dropbox...
The Dropbox daemon is not installed!
Run "dropbox start -i" to install the daemon
Запустить "dropbox start -i"
$ dropbox start -i
Starting Dropbox...Traceback (most recent call last):
File "/usr/bin/dropbox", line 1443, in start
download()
File "/usr/bin/dropbox", line 295, in download
gi.require_version('Gdk', '3.0')
File "/home/gaowei/anaconda3/lib/python3.7/site-packages/gi/__init__.py", line 130, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gdk not available