How to properly install Python on OSX for use with OpenCV?

前端 未结 4 1821
刺人心
刺人心 2021-02-06 15:38

I spent the past couple of days trying to get opencv to work with my Python 2.7 install. I kept getting an error saying that opencv module was not found whenever I try \"import

4条回答
  •  既然无缘
    2021-02-06 16:26

    Installing OpenCV with Homebrew

    brew tap homebrew/homebrew-science
    brew install opencv
    

    Setting up Python

    Depending on your install location - OS X Default

    cd /Library/Python/2.7/site-packages/
    

    or - Homebrew Python

    cd /usr/local/lib/python2.7
    

    Then create the symbolic link

    ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
    ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so cv2.so
    

    The above method sourced from a blog post.

提交回复
热议问题