python opencv version mismatch

Viewed 41

I have a conflict between which version of opencv is installed vs which is used.

I installed opencv using apt-get and then used pip to upgrade to latest version.

$ sudo pip3 freeze | grep opencv
opencv-python==4.6.0.66

$ sudo python3 -c 'import cv2; print(cv2.__version__)'
4.5.5

$ sudo python3 -c 'import cv2; print(cv2.__file__)'
/usr/local/lib/python3.7/dist-packages/cv2/__init__.py

As you can see, pip sees opencv 4.5.5 but python3 sees opencv 4.6

I am using raspbian:

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

How do I get python3 to see the correct version of opencv? (4.6)

0 Answers
Related