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

Leave a Reply

Related Posts

Programming

Living with Android Studio 1: Slow and steady wins the race?

So I’ve started dabbling with programming on Android, and Android Studio is the way to go, right? Well, my first experiences with it were a little bit overwhelming. To start things off, when I first Read more…

Programming

On Error Conditions

“Never test for an error condition you don’t know how to handle.” — Daniel Keys Moran Related

Programming

Informal C++ conditional statements

I like to be very informal with my compilers! Related