如何在python2.7中安装gtk?

Pen*_*eng 8 python gtk

我正在使用Debian 6.04和Python 2.7

在控制台中编译了Python 2.7,(./ configure,make,make install):

>python2.7  
Python 2.7.3 (default, Jul 28 2012, 16:54:06) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gtk
Run Code Online (Sandbox Code Playgroud)

如何在Python 2.7中安装gtk?

在Python 2.6中:

tiger@debian:~$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
>>> import pygtk
>>> import gobject
Run Code Online (Sandbox Code Playgroud)

Mic*_*hal 5

尝试使用 pip/python-pip/easy_install 安装它。在 Fedora 上我是这样安装的:

sudo pip install PyGTK
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,由于某种原因,我收到此错误“仅在 Windows 上支持使用 distutils 构建 PyGTK。” (55认同)