MacOS – Segmentation fault: 11 error ( OpenCV )

homebrewmacospython

I've installed OpenCV, numpy and all other required contents using brew install opencv.

Then I tried running it python >> import cv or python >> import cv2 but I get a "Segmentation fault: 11" error. Crash Log

Best Answer

Maybe duplicate of https://stackoverflow.com/questions/28669587/python-segmentation-fault-11-when-running-import-cv-or-import-cv2. Did you install python through brew? If yes then there is probably crash between built-in version that ships with macOS and that installed through brew. Try using absolute path /usr/bin/python -c "import cv2" (built-in) and /usr/local/bin/python -c "import cv" (from brew). One should probably work.