PySideのセットアップ (Windows XP x64 環境)
PySide (GUIライブラリQtのPython bindings) のセットアップをWindows x64環境で行った作業記録.
0. 作業した環境
- Microsoft Windows XP Professional x64 Edition
- Visual Studio 2008 Professional Edition
- Python 2.6 (x64)
- cmake version 2.8.2
1. Qtのセットアップ
windows 64bit版のbinaryは用意されていないようなので,ソースからビルドする.
- ソースの入手
- http://qt.nokia.com/downloads/ から qt-everywhere-opensource-src-4.7.2.zip をダウンロード
- ディレクトリへの展開 (ここでは,C:\lib\Qt_x64\4.7.2 とした)
- configure
- "Visual Studio 2008 x64 Win64 コマンドプロンプト"から次を実行
> cd C:\lib\Qt_x64\4.7.2
> configure
-
- 選択肢が出る
- Edition (Commercial Edition / Open Source Edition) について: Open Source 版を選択
- License (GPLv3/LGPLv2.1) 規約について確認: 承認
- configure開始: 数分の時間を要する
- 次のメッセージとともにconfigure終了
- 選択肢が出る
Qt is now configured for building. Just run nmake.
To reconfigure, run nmake confclean and configure.
-
- nmakeを実行
> nmake
-
- ビルド開始: 数時間程度の時間を要する
- ビルド終了: 7.70GB 程になった.容量注意.
- PATH通し
- C:\lib\Qt_x64\4.7.2\bin
2. PySideのビルド
- http://developer.qt.nokia.com/wiki/PySideDownloads から次をダウンロード
- apiextractor-0.10.1.tar.bz2
- generatorrunner-0.6.8.tar.bz2
- shiboken-1.0.1.tar.bz2
- pyside-qt4.7+1.0.1.tar.bz2
- pyside-tools-0.2.8.tar.bz2
- 上の各種ビルドについて,CMake用の.batファイルを公開されている方がいるので,感謝しつつ使用する
- PySide for Windows 64bit - devlog から pyside-buildscripts をダウンロード
- 配布サイトの指示に従い,srcディレクトリに各種ソースを配置
- pyside-buildscripts の build-config.bat を自分の環境に編集
- 参考:各.batファイルの編集内容→PySideのセットアップ (Windows XP x64 環境) の補足 - e405の日記
- build-all.batを実行
- PySideのビルドに数十分程度を要する
- 420MB程度生成される.容量注意.
- buildされたモノの扱い
- PySide-buildscripts\build\lib\site-packages の中身を参照できるように
- PYTHONPATHを通す,C:\Python26\Lib\site-packagesにコピーするなど
- PySide-buildscripts\build\bin の pyside-python2.6.dll, shiboken-python2.6.dll を参照できるように
- PATHを通すなど
- PySide-buildscripts\build\lib\site-packages の中身を参照できるように
3. PySideの動作確認
>>> import PySide
が通れば(とりあえず)OKと思われる.
>>> import PySide >>> print PySide.__version__ 1.0.1
4. PySide の Examples
- http://qt.gitorious.org/pyside/pyside-examples/trees/master/examples/demos/qtdemo からtar.gz形式でダウンロード可能.さまざまなサンプルあり.
5. Visual Studio Add-in のインストール
ついでにC++の実行環境を整えておく.
- http://qt.nokia.com/downloads/visual-studio-add-in から qt-vs-addin-1.1.9.exe をダウンロード
- 実行
- VS 2005/2008/2010 のコンポーネントを選択できる
- Visual Studioを起動し,Qt>Qt Options>Qt Versions を設定
- Version name と Path を入力
6. Qt Creator IDE のセットアップ
ついでに統合環境を整備しておく.
- Debuggerの用意
- http://doc.trolltech.com/qtcreator-1.2/creator-debugging.html によれば,MSVC には Debugging Tools for Windows/Microsoft Console Debugger (CDB) が必要とある.
- CDB は Windows SDKに含まれている.詳細は http://msdn.microsoft.com/en-us/windows/hardware/gg463012.aspx
- ソース入手
- http://qt.nokia.com/downloads の Qt Creator 2.1 Source Package から qt-creator-2.1.0-src.zip をダウンロード.
- ビルド
- READMEファイルの次の記載に従う.ビルドには数分を要する.
We recommend that you build Qt Creator not in the source directory, but in a
separate directory. To do that, use the following commands:
mkdir $BUILD_DIRECTORY
cd $BUILD_DIRECTORY
qmake $SOURCE_DIRECTORY/qtcreator.pro
make (or mingw32-make or nmake or jom, depending on your platform)
- jom.exe のインストール
- nmakeの代替.マルチCPU環境で効力を発揮.これを記載している時点のバージョンはjom 1.0.4.
- binaryを解凍してPATHへ.
- jomについての解説: http://labs.qt.nokia.com/2009/03/27/speeding-up-visual-c-qt-builds/
- jomプロジェクトページ: http://qt.gitorious.org/qt-labs/jom
(補足)ビルド代替案など
- Win 32bit環境用ならバイナリあり.(MinGW用?未確認.)
- 64bitについて自前ビルドをしなくても,unofficialな野良ビルドを拾ってくる方法も考えられる.たとえば,Windows x64環境のPythonライブラリについては http://www.lfd.uci.edu/~gohlke/pythonlibs/ に多く提供されている.