Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not import opencv in python3 in Raspberry Pi3?

Tags:

python-3.x

Any solution for this error ?, need help :(

I import cv2 in python3:

import cv2

and it results like this:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/cv2/__init__.py", line 4, in <module>
    from .cv2 import *
ImportError: libQtTest.so.4: cannot open shared object file: No such file or directory
like image 799
Rodo Anh Avatar asked Apr 12 '18 14:04

Rodo Anh


2 Answers

Use this:

sudo apt install libqt4-test

Reference:

  • RPi-Stackexchange
like image 162
Nelson Sequiera Avatar answered Sep 20 '22 23:09

Nelson Sequiera


You can install opencv-python in raspberry with the following commands:

pip3 install opencv-python 

sudo apt-get install libatlas-base-dev 

sudo apt-get install libjasper-dev 

sudo apt-get install libqtgui4 

sudo apt-get install python3-pyqt5 

sudo apt install libqt4-test
like image 41
user12348536 Avatar answered Sep 22 '22 23:09

user12348536