【发布时间】:2011-12-14 07:18:24
【问题描述】:
我需要在我的 Ubuntu 系统上使用两个 python 版本:2.6.5 和 2.7.2(为了与一些第三方项目兼容)。
对于他们两个,我都需要 PyGTK 包。
我安装了这个包的最新版本,但奇怪的是只有2.6版本能识别它; 2.7版本找不到:
erelsgl@ubuntu:/usr/lib$ python2.6
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
>>> print pygtk._get_available_versions()
{'2.0': '/usr/lib/gtk-2.0'}
>>> quit()
erelsgl@ubuntu:/usr/lib$ python
Python 2.7.2 (default, Aug 16 2011, 09:51:01)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pygtk
>>>
【问题讨论】:
-
值得,在我的系统中,我有:
/usr/share/pyshared/pygtk.pth和/usr/share/pyshared/pygtk.py,它们都在/usr/lib/python2.X/dist-packages中链接。但是,每个 python 版本都有一个不同的.pyc文件(我使用了我的操作系统包安装程序)。