brewでopencvが入らないことがあった

[local :~]$ brew install opencv
==> Downloading https://github.com/Itseez/opencv/archive/2.4.9.tar.gz
Already downloaded: /Library/Caches/Homebrew/opencv-2.4.9.tar.gz
tar: Failed to set default locale
==> cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/opencv/2.4.9 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DCMAKE_OSX_DEPLOYMENT_TARGET= -DBUILD_ZLIB=OFF -DBUILD_TIFF=OFF -DBUILD_PNG=OFF -DBUILD_OPENEXR=OFF -DBUILD
==> make
make[2]: *** Waiting for unfinished jobs....
[100%] Building CXX object modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o
cd /tmp/opencv-AiDbmm/opencv-2.4.9/macbuild/modules/python && /usr/local/Library/ENV/4.3/clang++   -DPYTHON_USE_NUMPY=1 -Dopencv_python_EXPORTS -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -fno-omit-frame-pointer -msse -msse2 -mavx -Wno-unused-function -fPIC -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/python/src2 -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/contrib/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/nonfree/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/ocl/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/gpu/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/photo/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/objdetect/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/legacy/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/video/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/ml/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/calib3d/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/features2d/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/highgui/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/imgproc/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/flann/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/core/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/macbuild/modules/python -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/python/src -I/tmp/opencv-AiDbmm/opencv-2.4.9/modules/python/include -I/tmp/opencv-AiDbmm/opencv-2.4.9/macbuild -isystem /Users/kamatari/.pyenv/versions/2.7.6/include/python2.7 -isystem /usr/local/lib/python2.7/site-packages/numpy/core/include    -o CMakeFiles/opencv_python.dir/src2/cv2.cpp.o -c /tmp/opencv-AiDbmm/opencv-2.4.9/modules/python/src2/cv2.cpp
make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2
make: *** [all] Error 2

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/homebrew/homebrew-science/issues

大文字で書いてあるREAD THIS 通りに、homebrewのページを見てbrew doctorをやって全部解消しても直らなかった。

python の pyenvと相性が悪いらしい

相性って…と思いつつ、pyenvをuninstall

$ brew uninstall pyenv

あらためてopencvをinstallしたら、入れることができた。 なのでopencvを入れた後に、pyenvを再びinstallする。

$ brew install opencv
$ brew install pyenv