I installed OpenCV 3.2 from source, as I wanted to get it working with ffmpeg. But, after install, when I tried to import it into a script, I got the following error:

ModuleNotFoundError: No module named 'cv2'

Turns out that the default install location when you build from source is /usr/local. Even though I ran ldconfig, I still got the import error. So I manually linked the .so file at the proper path:

ln -s /usr/local/lib/python3.6/site-packages/cv2.cpython-36m-x86_64-linux-gnu.so /usr/lib/python3.6/site-packages/cv2.so


That’s it! Now it works like a charm ?

Categories: Programming

%d bloggers like this: