- 使用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