简体   繁体   English

无法在macOS Sierra中安装openCV

[英]Can't install openCV in macOS Sierra

I tried to install openCV in macOS Sierra as given in the site: www.pyimagesearch.com . 我试图在macOS Sierra中安装openCV,如网站所示: www.pyimagesearch.com The code was build successfully but when I try to access the openCV this error shows up. 代码已成功构建,但是当我尝试访问openCV时出现此错误。

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cv2.so, 2): Symbol not found: __ZL13pyopencv_fromIN2cv4MatxIdLi4ELi4EEEEP7_objectRKT_
  Referenced from: /usr/local/lib/python2.7/site-packages/cv2.so
  Expected in: flat namespace
 in /usr/local/lib/python2.7/site-packages/cv2.so

One workaround that worked for me was to first install anaconda: 对我有用的一种解决方法是先安装anaconda:

https://conda.io/docs/installation.html https://conda.io/docs/installation.html

Then, make a downgrade of the python version and install opencv3: 然后,将python版本降级并安装opencv3:

conda install python=3.5
conda install -c menpo opencv3

This worked as a charm for me. 这对我来说是一种魅力。

EDIT 编辑

You can also install through pip using the following: 您还可以使用以下方法通过pip安装:

pip install opencv-python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM