Re: ImportError: No module named gtk



PYTHONPATH was wrong:

When python and gnome not installed in same prefix. Set your PYTHONPATH
correct. Or alacarte, sabayon, .. will not work.

bash-3.1$ export
PYTHONPATH=/G2XM/lib/python2.5/site-packages:/G2XM/lib/python2.5/site-packages/gtk-2.0 
bash-3.1$ python
Python 2.5 (r25, Mar 18 2007, 02:40:10) 
[GCC 4.1.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/G2XM/lib/python2.5/site-packages',
'/G2XM/lib/python2.5/site-packages/gtk-2.0', '/dummy/lib/python25.zip',
'/dummy/lib/python2.5', '/dummy/lib/python2.5/plat-linux2',
'/dummy/lib/python2.5/lib-tk', '/dummy/lib/python2.5/lib-dynload',
'/dummy/lib/python2.5/site-packages']
>>> 
bash-3.1$ alacarte 
bash-3.1$ 


On Sun, 2007-04-22 at 06:12 +0200, Ron Wezeman wrote:
> -bash-3.1# which python
> /dummy/bin/python
> -bash-3.1# 
> 
> -bash-3.1# python -c "import sys; print sys.version[:3]"
> 2.5
> -bash-3.1# 
> 
> -bash-3.1# env
> PYTHONPATH=/G2XM/lib/python2.5/site-packages
> 
> gar.conf.mk:
> # If you want to use a different version of python everywhere
> # change this
> PYTHON = /dummy/bin/python
> PYVER = $(shell $(PYTHON) -c "import sys; print sys.version[:3]")
> PYTHONPATH=$(main_libdir)/python$(PYVER)/site-packages:
> $(main_libdir)/python$(PYVER)/site-packages/gtk-2.0
> 
> -bash-3.1# ls /G2XM/lib/python2.5/site-packages/*gtk*
> /G2XM/lib/python2.5/site-packages/pygtk.pth
> /G2XM/lib/python2.5/site-packages/pygtk.py
> /G2XM/lib/python2.5/site-packages/pygtk.pyc
> /G2XM/lib/python2.5/site-packages/pygtk.pyo
> 
> /G2XM/lib/python2.5/site-packages/gtk-2.0:
> atk.la        gconf.so         gobject           gtop.so
> rsvg.la
> atk.so        gnome            gtk               mediaprofiles.la
> rsvg.so
> bonobo        gnomeapplet.la   gtkhtml2.la       mediaprofiles.so  totem
> bugbuddy.py   gnomeapplet.so   gtkhtml2.so       metacity.la
> vtemodule.la
> bugbuddy.pyc  gnomecanvas.la   gtkmozembed.la    metacity.so
> vtemodule.so
> bugbuddy.pyo  gnomecanvas.so   gtkmozembed.so    nautilusburn.la
> wnck.la
> dsextras.py   gnomedesktop     gtksourceview.la  nautilusburn.so
> wnck.so
> dsextras.pyc  gnomekeyring.la  gtksourceview.so  pango.la
> dsextras.pyo  gnomekeyring.so  gtkunixprint.la   pango.so
> egg           gnomeprint       gtkunixprint.so   pangocairo.la
> gconf.la      gnomevfs         gtop.la           pangocairo.so
> -bash-3.1# 
> 
> -bash-3.1# ls /G2XM/lib/python2.5/site-packages/gtk-2.0/gtk
> __init__.py   _gtk.so         compat.py       deprecation.pyc
> keysyms.py
> __init__.pyc  _lazyutils.py   compat.pyc      deprecation.pyo
> keysyms.pyc
> __init__.pyo  _lazyutils.pyc  compat.pyo      glade.la
> keysyms.pyo
> _gtk.la       _lazyutils.pyo  deprecation.py  glade.so
> -bash-3.1# 
> 
> -bash-3.1# python
> Python 2.5 (r25, Mar 18 2007, 02:40:10) 
> [GCC 4.1.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> sys.path
> ['', '/G2XM/lib/python2.5/site-packages', '/dummy/lib/python25.zip',
> '/dummy/lib/python2.5', '/dummy/lib/python2.5/plat-linux2',
> '/dummy/lib/python2.5/lib-tk', '/dummy/lib/python2.5/lib-dynload',
> '/dummy/lib/python2.5/site-packages']
> >>> 
> -bash-3.1# 
> 
> -bash-3.1# cd platform/gtk+
> -bash-3.1# make install
> [===== NOW BUILDING:    gtk+-2.10.11    =====]
>         [fetch] complete for gtk+.
>         [checksum] complete for gtk+.
>         [extract] complete for gtk+.
>         [patch] complete for gtk+.
>         [fixup] complete for gtk+.
>         [configure] complete for gtk+.
>         [build] complete for gtk+.
>         [install] complete for gtk+.
> -bash-3.1# 
> 
> -bash-3.1# cd desktop/alacarte/
> -bash-3.1# make install
> [===== NOW BUILDING:    alacarte-0.11.3 =====]
>         [fetch] complete for alacarte.
>         [checksum] complete for alacarte.
>         [extract] complete for alacarte.
>         [patch] complete for alacarte.
>         [fixup] complete for alacarte.
>         [configure] complete for alacarte.
>         [build] complete for alacarte.
>         [install] complete for alacarte.
> -bash-3.1# 
> 
> -bash-3.1# alacarte 
> Traceback (most recent call last):
>   File "/G2XM/bin/alacarte", line 22, in <module>
>     from Alacarte.MainWindow import MainWindow
>   File "/G2XM/lib/python2.5/site-packages/Alacarte/MainWindow.py", line
> 19, in <module>
>     import gtk, gtk.glade, gmenu, gobject, gnomevfs, gnome.ui
> ImportError: No module named gtk
> -bash-3.1# 
> 
> 
> What now?
> 
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]