title: How to find shared library used by a python module?
body: <p>I am debugging a python program based on <a href="http://www.pygtk.org/" rel="noreferrer">pygtk</a> and I want to make sure that the program is using the right shared library.</p>
  
  <p><code>pygtk</code> is a <code>GTK+</code> wrapper for python. I have already compiled <code>GTK+</code> using <code>jhbuild</code> tool and I want to make sure that the python script which I am debugging uses the compiled library from <code>jhbuild</code>.</p>
  
  <p>One would import <code>gtk</code> and <code>pygtk</code> like this:</p>
  
  <pre><code>import gtk
  import pygtk
  print(gtk.__file__)
  # /usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.pyc
  print(pygtk.__file__)
  # /usr/lib/python2.7/site-packages/pygtk.pyc
  </code></pre>
  
  <p>For example I can show a window using gtk:</p>
  
  <pre><code>w = gtk.Window()
  w.show()
  </code></pre>
  
  <p>This will draw a window on the screen using gtk. However I don't know which shared object is be used. I have many versions installed and I need to find the culprit.</p>