I'm trying to use OpenCV with Python but I'm continuously getting errors while importing. I'm using Anaconda virtual env and ZSH on Mac M1.
I have tried installing it using
conda install -c anaconda opencv
and pip3 install opencv-python
but I'm getting this error:
from .cv2 import * ImportError: dlopen(/Users/username/Library/Python/3.8/lib/python/site-packages/cv2/cv2.cpython-38-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/ffmpeg/lib/libavcodec.58.dylib Referenced from: /Users/username/Library/Python/3.8/lib/python/site-packages/cv2/cv2.cpython-38-darwin.so Reason: tried: '/opt/homebrew/opt/ffmpeg/lib/libavcodec.58.dylib' (no such file), '/usr/local/lib/libavcodec.58.dylib' (no such file), '/usr/lib/libavcodec.58.dylib' (no such file)