Has anyone ever had OpenCV work with Python 2.7 on MacOS 10.6?

前端 未结 4 1838
无人及你
无人及你 2021-02-13 07:13

I\'ve been trying on and off for the past 6 months to get OpenCV to work with Python on MacOS. Every time there\'s a new release, I try again and fail. I\'ve tried both 64-bit a

相关标签:
4条回答
  • 2021-02-13 07:53

    It works all right for me. Here's my setup:

    Python 2.7.2 (default, Jan 13 2012, 17:11:09) 
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cv
    >>> 
    
    0 讨论(0)
  • 2021-02-13 07:58
    brew install opencv
    

    works like a charm

    0 讨论(0)
  • 2021-02-13 08:04

    I have tried to install opencv +python27 with Macports and, likewise, I cannot import opencv. If I give up on Python 2.7 and use the Python 2.6 version, it just works. I haven't gone further than this. Good luck!

    0 讨论(0)
  • 2021-02-13 08:08

    Coincidentally, I did this yesterday, and it works now. I used the guide found here, in Section 2, "Building via Homebrew".

    Except, it says.

    sudo brew install python     ( the system python is not good enough)
    

    DO NOT ADD THIS LINE. It gave me so much trouble. Python 2.6.1 runs perfectly with OpenCV. By adding that line, homebrew installs Python2.7, and OpenCV will then bind to that version in stead of the default system version. You can then move the cv.so file, but you will still get the version mismatch error.

    I don't know why you were downvoted, it's a legitimate problem, perhaps people think you should take your problem to the OpenCV people.

    0 讨论(0)
提交回复
热议问题