安装opencv

2018-11-09  本文已影响0人  onbug
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
上一篇 下一篇

猜你喜欢

热点阅读