Install OpenCV on Raspberry Pi 3B+ for python3.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

References

https://pypi.org/project/opencv-python/

https://www.raspberrypi.org/forums/viewtopic.php?t=232294

https://www.learnopencv.com/install-opencv-4-on-raspberry-pi/

https://www.pyimagesearch.com/2018/09/26/install-opencv-4-on-your-raspberry-pi/

OS – Raspian Buster with desktop and recommended software. Release date 2020-02-13.

https://www.raspberrypi.org/downloads/raspbian/

Uninstall previous versions

sudo pip3 uninstall opencv-python

Install dependencies

sudo apt-get install libhdf5-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libjasper-dev
sudo apt-get install libqtgui4
sudo apt-get install libqt4-test

Easy install

At present, OpenCV only supports Raspberry Pi 3B+ is up to version 3.4.6.

pip3 install opencv-python==3.4.6.27

Verify installation

python3 -c 'import cv2; print(cv2.__version__)'
Success!!

OpenCV Documentation

https://docs.opencv.org/master/

Errors

ImportError: /home/pi/.local/lib/python3.7/site-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8

To fix the error message above, install dependencies as shown above in instructions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.