Pythonからmayaviを使う
Pythonでmayavi(読み方は、まやびぃ)を使いたい。実行環境、Windows XP。すでにvtkがインストールされていることが前提条件(PythonからVTKを使うための準備)。
mayaviのバイナリをダウンロードしてインストールしても、mayaviをモジュールとしてimportすることはできない。ソースからインストールする必要がある。
ソースのダウンロード
http://mayavi.sourceforge.net/download.html
ここから、MayaVi-1.5.tar.gzをいただく。このtarballを解凍して「MayaVi-1.5」フォルダが現れる。その中のフォルダ構成は下図の通り。
このフォルダをどこでもいいが、どこかに置いておく。
テスト
このあたりの話か?エラーはなくなったけど、ウィンドウは何も起動しない。
Calling Tcl methods through _tkinter no longer returns only strings. Instead, if Tcl returns other objects those objects are converted to their Python equivalent, if one exists, or wrapped with a _tkinter.Tcl_Obj object if no Python equivalent exists. This behavior can be controlled through the wantobjects() method of tkapp objects.
When using _tkinter through the Tkinter module (as most Tkinter applications will), this feature is always activated. It should not cause compatibility problems, since Tkinter would always convert string results to Python types where possible.
If any incompatibilities are found, the old behavior can be restored by setting the wantobjects variable in the Tkinter module to false before creating the first tkapp object.
import Tkinter
Tkinter.wantobjects = 0Any breakage caused by this change should be reported as a bug.
http://docs.python.org/release/2.3/whatsnew/node18.html