Frank
Frank

Reputation: 492

Unable to use OpenCV in python on Ubuntu 16.04

On my Ubuntu 16.04, I have installed OpenCV for python from the Ubunto repos using the command

sudo apt-get python-opencv

This installs the required libopencv-core2.4v5 and related packages & Python libraries via the dependencies.

When I try to import the cv2 from Python, I get the following error:

$ python
Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/lib/x86_64-linux-gnu/libavutil.so.52: version `LIBAVUTIL_52' not found (required by /usr/local/lib/libopencv_highgui.so.2.4)
>>>

This should work out-of-the box. I have tried to install various combinations of extra packages from the repo without much luck.

/usr/lib/x86_64-linux-gnu/libavutil.so.52 appears to be a symbolic link:

$ ls -l /usr/lib/x86_64-linux-gnu/libavutil.so.52
lrwxrwxrwx 1 root root 38 Oct 26  2015 /usr/lib/x86_64-linux-gnu/libavutil.so.52 -> /usr/lib/x86_64-linux-gnu/libavutil.so

I wonder if anyone has seen this before and/or have any recommendations as to how I can resolve this. I have some faces, that needs detection :)

Upvotes: 0

Views: 376

Answers (1)

Frank
Frank

Reputation: 492

I used the script provided in How to install openCV 2.4.13 for Python 2.7 on Ubuntu 16.04? as suggested by @pyan, which solved my problem.

Upvotes: 1

Related Questions