matplotlibのインストールにつまずいたお話
新しいmacbookにmatplotlibをインストールしようとした時に少しつまずいたので備忘録として記事にします。
1. 吐き出したエラー達
まず普通に
pip install matplotlib
でインストールしようとすると
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-oeUHU7/matplotlib
と出ました。
もう少し上の文を見ると
* The following required packages can not be built : * freetype * Try installing free type with `brew install * freetype` and pkg-config with `brew install pkg- *config
と書いてあったので
brew install freetype brew install pkg-config
でそれぞれインストールしました。
その後、(念のためpipをupgradeする)
pip install --upgrade pip
pip install marplotlib
とすると、先ほどとは違う感じになってうまく行きそうになるがやっぱり失敗します。
原因を探ると、
Uninstalling six-1.4.1: (略) OSErro: [Errno 1] Operation not permitted (hoge hoge)
つまり、すでにインストールされていたsixをアンインストールしようとしてるけど権限がなくてエラーが起きているそうです。
2. 解決策
なので、sixを無視するために、
pip install matplotlib --ignore-installed six
というオプションをつけました。
その結果、無事インストールに成功しました。