2014年09月15日

Ubuntuでcanopy使うとrequire wxPython >= 2.8的なエラーが出る

Pythonによるデータ分析入門を買ったのでcanopyを試してみたところ、pylabを使うところで下記のようなエラーが出る。

ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8

versionはcanopy1.4.1(64bit)。
調べてみると下記のような話らしい。

wxPython import error
http://stackoverflow.com/questions/5121574/wxpython-import-error

wxPython 2.8 and 2.9
https://support.enthought.com/entries/22601196-wxPython

Python ImportError with backend_wx2.8 and wxPython when using Matplotlib
http://www.koverholt.com/2010/05/python-importerror-of-backend_wx2-8-and-wxpython-when-using-matplotlib/

いろいろ解決方法はありそうだけど、backendをWXAggからTKAggにしておけば話が早そうなので設定を直す。

$ vi ~/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc


上記ファイルを編集。

backend      : WXAgg

backend : TKAgg


これでエラーが消えた。