pygtk install holly demo

he answer will have two parts.

First is the installation of Cairo (and its dependencies) and Pango (with its dependencies). When both of those are installed in the right order, pangocairo will be compiled automatically by virtue of Pango finding Cairo during its configuration phase (it's libpangocairo-1.0.so).

Second is the installation of pygtk, which is the python binding which allows python to interact with these packages and includes the pangocairo binding. It requires pygobject and pycairo.

I had to install CairoPango, and pygobject as part of this massive Xfce install guide. Here are the install commands for just this set of packages (and their dependencies) using the same mirrored files where possible, for convenience:

mkdir -p $HOME/src $HOME/tmp
export TMPDIR="$HOME/tmp"
export PATH="$HOME/bin:$PATH"
export C_INCLUDE_PATH="$HOME/include:$C_INCLUDE_PATH"
export LIBRARY_PATH="$HOME/lib:$LIBRARY_PATH"
export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"
export CPPFLAGS="-I$HOME/include $CPPFLAGS"
export LDFLAGS="-L$HOME/lib $LDFLAGS"
export PKG_CONFIG_PATH="$HOME/lib/pkgconfig"

export PYTHON=python2.7
mkdir -p $HOME/lib/${PYTHON}

# =========================================
# pixman 0.24.4
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/pixman-0.24.4.tar.gz'
tar -xzf pixman-0.24.4.tar.gz
cd pixman-0.24.4
./configure --prefix=$HOME
make
make install

# =========================================
# cairo 1.12.0
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/cairo-1.12.0.tar.gz'
tar -xzf cairo-1.12.0.tar.gz
cd cairo-1.12.0
./configure --prefix=$HOME
make    # 2m
make install

# =========================================
# libffi 3.0.11
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/libffi-3.0.11.tar.gz'
tar -xzf libffi-3.0.11.tar.gz
cd libffi-3.0.11
./configure --prefix=$HOME
make
make install

# =========================================
# Glib 2.31.22
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/glib-2.31.22.tar.xz'
tar -xJf glib-2.31.22.tar.xz
cd glib-2.31.22
PYTHON=${PYTHON} ./configure --prefix=$HOME
make    # 2.5m
make install

# =========================================
# pango 1.30.0
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/pango-1.30.0.tar.xz'
tar -xJf pango-1.30.0.tar.xz
cd pango-1.30.0
./configure --prefix=$HOME --sysconfdir=$HOME/etc
make    # 22s
make install

# =========================================
# pygobject 2.28.6
# =========================================
cd $HOME/src
wget 'http://mirror.ryansanden.com/xfce-4.8/pygobject-2.28.6.tar.bz2'
tar -xjf pygobject-2.28.6.tar.bz2
cd pygobject-2.28.6
PYTHON=${PYTHON} ./configure --prefix=$HOME --disable-introspection
make
make install

# =========================================
# py2cairo 1.10.0
# =========================================
cd $HOME/src
wget 'http://www.cairographics.org/releases/py2cairo-1.10.0.tar.bz2'
tar -xjf py2cairo-1.10.0.tar.bz2
cd py2cairo-1.10.0
$PYTHON ./waf configure --prefix=$HOME
$PYTHON ./waf build
$PYTHON ./waf install

# =========================================
# pygtk 2.24.0
# =========================================
cd $HOME/src
wget 'http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.24/pygtk-2.24.0.tar.bz2'
tar -xjf pygtk-2.24.0.tar.bz2
cd pygtk-2.24.0
./configure --prefix=$HOME
make    # 22s
make install

Then, just run $PYTHON and you can import all of the following modules:

Python 2.7.3 (default, May 18 2012, 14:51:16) 
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>> import pango
>>> import pangocairo
>>> import glib
>>> import gobject
>>> import pygtk
>>>

Hope that helps!

link
This answer is marked "community wiki".

answered 22 Nov '12, 00:56

ryans's gravatar image

ryans ♦♦
3.8k1527
accept rate: 44%

edited 22 Nov '12, 01:36

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值