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

前端 未结 4 1890
刺人心
刺人心 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:25

    I searched and tried installing opencv3 with python3 for 3 days. Some links suggest for Brew and some virtual env, some say install xcode but all failed in my case. Dont use linux steps to instal opencv-python on Mac. Problem with Mac is Python 2.7 is already installed by Mac. On top of that installing and linking all site-packages is little problematic and we end up with errors.

    I'll share what I did: easy steps to install complete package opencv3, numpy, matplotlib, notebook, spyder etc.. on Mac.

    1. Install anaconda, it creates a directory and install everything inside that use this link -> https://www.continuum.io/downloads download command-line-install

    2. After download, goto terminal and download location of anaconda. $ bash Anaconda3-4.3.0-MacOSX-x86_64.sh

    3. Installation will ask you to append path to .bash_profile >> say yes

    4. Goto home directory, run .bash_profile $ source .bash_profile

    5. check python, should be pointing to $ which python $ /.../anaconda/bin/python

    6. Last step $ pip install opencv-pyhton

    $ python

    $ import cv2

    if no errors, we are good to go.

提交回复
热议问题