OS X 上 Anaconda で Tk 使おうとしてエラーが出たときの対処法

OS X 上に pyenv を使って Anaconda 環境を作った。

git clone https://github.com/yyuu/pyenv.git ~/.pyenv
# 中略
pyenv install anaconda3-4.1.0

その環境で Tk を使おうとしたらこんなエラーが出た。

objc[15737]: Class TKApplication is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Users/keik/.pyenv/versions/anaconda3-4.1.0/lib/libtk8.5.dylib. One of the two will be used. Which one is undefined.
objc[15737]: Class TKMenu is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Users/keik/.pyenv/versions/anaconda3-4.1.0/lib/libtk8.5.dylib. One of the two will be used. Which one is undefined.
objc[15737]: Class TKContentView is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Users/keik/.pyenv/versions/anaconda3-4.1.0/lib/libtk8.5.dylib. One of the two will be used. Which one is undefined.
objc[15737]: Class TKWindow is implemented in both /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Users/keik/.pyenv/versions/anaconda3-4.1.0/lib/libtk8.5.dylib. One of the two will be used. Which one is undefined.
Exception in Tkinter callback
Traceback (most recent call last):
  File "/Users/keik/.pyenv/versions/anaconda3-4.1.0/lib/python3.5/site-packages/matplotlib/backends/tkagg.py", line 22, in blit
    id(data), colormode, id(bbox_array))
_tkinter.TclError: invalid command name "PyAggImagePhoto"

エラーメッセージ _tkinter.TclError: invalid command name "PyAggImagePhoto" でググッて出てきた これ の通り、matplotlib を再インストールしたら治った。

pip uninstall matplotlib
pip install matpotlib

検索結果から対処方法が微妙に見つけにくかったので一応メモ。