天天看点

PyGobject(一)安装篇使用jhbuild安装Windows下安装

  • 使用jhbuild安装
    • 安装jhbuild
    • 安装gtk3核心库
    • 安装pygobject和gtk
  • Windows下安装
PyGObject是一个Python模块,使开发人员可以访问基于GObject的库,如Python中的GTK+。它独家支持GTK+3版或更高版本。

由于博主使用的是macbook,所以安装方法适用于Mac OS X,其它系统大致相同,可以参考。

使用jhbuild安装

安装jhbuild

$ brew install wget
$ sh gtk-osx-build-setup.sh 
设置环境变量
$ export PATH=~/.local/bin:$PATH
$ jhbuild bootstrap  
           

可能报错:

1.jhbuild: The default location of the configuration file has changed. Please move /Users/xiaosanyu/.jhbuildrc to /Users/xiaosanyu/.config/jhbuildrc.

解决办法:

$ cp /Users/xiaosanyu/.jhbuildrc /Users/xiaosanyu/.config/jhbuildrc
$ rm /Users/xiaosanyu/.jhbuildrc
           

2.EnvironmentError: MacOSX10.10.sdk not found

解决办法:

下载MacOSX10.10.sdk,将解压后的文件夹放到如下路径下

Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

3.configure: error: XML::Parser perl module is required for intltool

解决办法:

下载XML-Parser

解压后编译安装

$ perl Makefile.PL
$ make
$ make install
           

安装gtk3核心库

如果报错:

checking for XML::Simple… configure: error: XML::Simple perl module is required for icon-naming-utils

选4

进入网站http://download.gnome.org/teams/releng/ 下载最新的xxx. modules

放到~/Source/jhbuild/modulesets中

然后修改~/.config/jhbuildrc,最后添加

use_local_modulesets = True

makeargs ='-j16'
moduleset = "gnome-apps-3.20"
autogenargs='--disable-static --disable-gtk-doc PYTHON=python3'
modules = [ 'meta-gnome-core', 'meta-gnome-apps-tested' ]
skip = ['telepathy-logger','gtk-doc','glade', 'telepathy-mission-control', 'gnome-photos', 'gitg', 'vala','gdlmm']
module_autogenargs['pygobject']= '--with-python=/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4'
module_autogenargs['glib-networking']='--without-ca-certificates'
           

安装pygobject和gtk+

$ jhbuild sanitycheck
$ jhbuild build pygobject
$ jhbuild build gtk+
           

如果报错

No package ‘cairo-gobject’ found

$ git clone git://anongit.freedesktop.org/git/cairo
$ cd cairo
$ ./autogen.sh --prefix=/Users/xiaosanyu/gtk/inst PYTHON=python3  --enable-xcb-shm  --enable-quartz
$ make -j16
$ make install
           

报错Requested ‘libpcre >= 8.13’ but version of libpcre is 8.02

下载libpcre

$ tar -vxzf /Users/xiaosanyu/Downloads/pcre-.tar.gz
$ cd pcre-
$ ./configure --enable-pcre16 --enable-pcre32 --enable-ucp --enable-unicode-properties --enable-rebuild-chartables --enable-newline-is-any
$ make
$ make install

$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
           

报错No package ‘py3cairo’ found

安装py3cairo

$ git clone git://git.cairographics.org/git/pycairo
$ cd pycairo
$ python3 setup.py install
$ export PKG_CONFIG_PATH=/Library/Frameworks/Python.framework/Versions//lib/pkgconfig:$PKG_CONFIG_PATH
           

成功后,将~/gtk/inst/lib/python3.4/site-packages中的内容拷贝到python3的site-packages目录下

Windows下安装

见博主另一博文

http://blog.csdn.net/a87b01c14/article/details/52229393

代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728