PyQtの環境づくり + MacOSX

PyCon JP 2011のセッションで見かけた「PyQtではじめるGUIプログラミング / Tutorial: GUI Programming with PyQt」がとっても良かったので、さっそくPyQtやろうと思って、Macで環境づくりした。

前提

homebrewpythonbrewがインストールされているMac。
homebrewだけでいける気がするけど、どうせだからpythonbrewのとこに入れてみる。

PyQt

Python3.2.1のインストール。

$ pybrew install -nv -j4 --framework 3.2.1  
$ pybrew switch 3.2.1  

Qtのインストール。

$ brew install qt  

PyQtの前にSIPのインストール。

$ wget http://www.riverbankcomputing.com/static/Downloads/sip4/sip-4.12.4.tar.gz  
$ tar zxvf sip-4.12.4.tar.gz  
$ cd sip-4.12.4  
$ python configure.py  
$ make  
$ make install  

PyQtのインストール。

$ wget http://www.riverbankcomputing.com/static/Downloads/PyQt4/PyQt-mac-gpl-4.8.5.tar.gz  
$ tar zxvf PyQt-mac-gpl-4.8.5.tar.gz  
$ cd PyQt-mac-gpl-4.8.5  
$ python configure.py  
$ make -j4  
$ make install  

Qtのドキュメント

homebrewでqtをインストールしたときに一緒に入るっぽい。Assistant.appとかDesigner.appとか。

とりあえずホームディレクトリのApplicationsにAssistant.appのリンクを作って、それを起動する形にした。

$ cd ~/Applications/  
$ ln -s /usr/local/Cellar/qt/4.7.3/bin/Assistant.app Assistant.app  

おしまい

ひさびさのGUI。PyQtなにかと楽でいいわあ。