I have been trying to use the cv2 library in python (in IDLE on raspberry pi 3) but I can't manage to import it successfully.
when I type import cv2, I get this:
Traceback (most recent call last):
File "/home/pi/Desktop/python/test.py", line 2, in <module>
from .cv2 import *
ImportError: libjasper .so.1: cannot open shared object file: No such file or directory
I have used the terminal to update, upgrade, and install opencv along with pretty much every other thing I could find relating to opencv or lib. I currently can import cv2 in the terminal but not in IDLE. What do I need to do to be able to import the cv2 library? Thanks in advance.
Recommended way of installing opencv on linux as given by opencv docs "https://docs.opencv.org/4.2.0/d2/de6/tutorial_py_setup_in_ubuntu.html" for python3 is:
sudo apt install python3-opencv
for python2:
sudo apt install python-opencv
On Raspberry pi you may occasionally need to run:
sudo apt update --fix-missing
It will auto-install all the dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With