Tinkerman255
Tinkerman255

Reputation: 355

Problems importing open cv in python

So I've been working with the Movidius neural network api, and it automatically installs several packages on the raspberry pi when you run the installer, including opencv. However, when I try to

import cv2

I get the error

from .cv2 import *
ImportError: libQtGui.so.4: cannot open shared object file: No such file or directory

does anyone know how to fix this?

Upvotes: 2

Views: 4657

Answers (2)

Ratheesh A - Intel
Ratheesh A - Intel

Reputation: 196

Assuming you are using Ubuntu mate or Raspbian stretch OS with python3.

If you are still facing issue with importing cv2, Try to install the following.

pip3 install opencv-python
sudo apt install libqtgui4
sudo apt install libqt4-test

This will pull all the dependencies and you can import cv2 without any issues.

Upvotes: 5

spaceman
spaceman

Reputation: 413

You might have done some system changes which led to the path mismatch of libQtGui. there are steps to solve this problem but it will take more time than installing OpenCV again with the configured libQtGui path. So I suggest you install your open cv version again. below is the link to install OpenCV from scratch it hardly takes 20 minutes. https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/

Upvotes: 0

Related Questions