我正在使用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
如何在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
sudo pip install
(一些答案建议这样做)。这将绕过主要的软件包管理系统,升级时可能会带来麻烦。请使用 virtualenv 或使用标准 Debian 软件源中提供的 pygtk 版本并通过 apt-get 安装它。为什么要编译 Python?Debian 中没有打包2.7版本吗? - Noufal Ibrahim