As a datapoint, I have a RH7.2 system which has python 1.5.2, GTK 1.2 and pygtk 0.6.6 installed in /usr. I installed python 2.2.2, GTK 2.0.6 and pygtk 1.99.13 in /usr/local.

/usr/local/bin/python can use import gtk to get 1.99.13 since there is no pygtk 0.6.x - import pygtk also works

/usr/bin/python can use import gtk to get 0.6.6

John

Johan Dahlin wrote:
tor 2003-01-02 klockan 11.53 skrev Christian Reis:
  
So, is import pygtk required or not for pygtk2?
    

It depends.

1) Where python is installed
2) How pygtk.pth looks like

If python is installed in a site dir, /usr or /usr/local (not in /opt or
/usr/local/pygtk), pygtk.pth is processed.

If pygtk.pth is processed the content of this file is added to sys.path.
For example, if it says gtk-2.0 and is in
/usr/local/lib/python2.2/site-packages, .../site-packages/gtk-2.0 will
be added to sys.path.

For example, if pygtk 0.6.x where x is higher than 11 is installed on a
Red Hat 8.0 system, which provides 1.99.12 we have the following
scenario:

import gtk            -> pygtk 1.99.12

import pygtk
pygtk.require('1.2') 
import gtk            -> pygtk 0.6.x

import pygtk
pygtk.require('2.0') 
import gtk            -> pygtk 1.99.12

As you can see pygtk is required for 0.6.x, but not for 1.99.12, since 

On a old system with 0.6.x as default, Red Hat 7.x for example, it's the
opposite import gtk -> 0.6.x and import pygtk;pygtk.require is required
for 1.99.x (which is installed by the user)

  

Reply via email to