Re: [Gtk-osx-users] Selecting Python installation for PyGtk
- From: Richard Procter <richard n procter gmail com>
- To: GTK+-2 OSX Users <gtk-osx-users lists sourceforge net>
- Subject: Re: [Gtk-osx-users] Selecting Python installation for PyGtk
- Date: Thu, 02 Dec 2010 15:23:46 +1300
Hi Ian,
On 15/11/2010, at 2:43 PM, Ian Bell wrote:
> [snip]
>
> import pygtk
>
> fails. I can see that the PyGtk is hiding in ~/gtk . How do I get the pygtk files to be found by my Python installation so that I can sucessfully use PyGtk on OSX?
The python sys.path needs to include pygtk, which a 'jhbuild shell' session achieves (amongst other things) by setting the PYTHONPATH environment variable appropriately.
regards,
Richard.
For example, on my system I have a small script that lets me work with multiple trees each in their own 'home jail'.
"buildshell.sh"
#!/bin/bash
ROOT=/Volumes/Vault/unstable
export PATH=${ROOT}/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin # .*sbin probably unnecessary
export HOME=${ROOT}
export IS_BUILDSHELL=1
bash
--
".bashrc" in /Volumes/Vault/unstable to help keep track of what's happening.
export PS1='\u@\h:\w\n\$ '
if [ -n "$IS_BUILDSHELL" ]; then export PS1="[buildshell - unstable/intel/10.6] $PS1" ; fi
if [ -n "$JHBUILD_PROMPT" ]; then export PS1="$JHBUILD_PROMPT $PS1"; fi
--
Having built my gtk/pygtk tree by running under a 'buildshell' and following the gtk-osx wiki instructions I can then
$ jhbuild shell
$ python
>>> import gtk # note: 'import pygtk; pygtk.require('2.0')' is no longer required as far as I know
>>> gtk.Window()
<gtk.Window object at 0x1c13198 (GtkWindow at 0x87d8b8)>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]