1

`I tried installing opencv on my raspi 3B using pip, on trying to import cv2 i am getting an error Attempt to install opencv on raspi 3B model with raspbian Buster Edit: code lines:

Successfully installed opencv-python-4.1.1.26

`(cv) pi@raspberrypi:~ $ workon cv
(cv) pi@raspberrypi:~ $ python

import cv2
Traceback (most recent call last):
File "", line 1, in
File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/cv2/init.py", l ine 3, in
from .cv2 import *
ImportError: libQtGui.so.4: cannot open shared object file: No such file or dire ctory`

EDIT
import cv2 is working
There was a library missing: sudo apt-install libQtGui4 worked for me

1
  • 4
    Please don't post pictures of text. It's unreadable. Instead paste the text direct into the question. Commented Feb 26, 2020 at 20:59

1 Answer 1

0

The reason you cannot access opencv in your virtualenv is because you have installed opencv in your system python environment. Each virtualenv keeps its packages separate from other vitualenvs and the system python. You can see the list of pacakges available from within each environment by pip list

To access opencv in your vitualenv:

workon cv pip install opencv-python 
2
  • i tried that as well, didnt help. Commented Feb 27, 2020 at 12:42
  • what is the output of pip list when you are in your virtual env? Commented Mar 1, 2020 at 19:20

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.