美文网首页
安装opencv

安装opencv

作者: onbug | 来源:发表于2018-11-09 17:06 被阅读0次
sudo pip install opencv-python

完成后若出现如下问题:

>>> import cv2
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import

这是因为系统调用了自带的numpy,把系统自带的numpy删掉

sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy

再重新安装numpy

sudo pip install numpy

相关文章

网友评论

      本文标题:安装opencv

      本文链接:https://www.haomeiwen.com/subject/ohvoxqtx.html