I was in trouble because I couldn't install or uninstall opencv well, but I managed to install it, so I will write the details.
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: /home/pi/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8
First, based on Installing OpenCV 3 on Raspberry Pi + Python 3 as easily as possible
$ sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103
$ sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
$ sudo apt-get install libatlas-base-dev
$ sudo apt-get install libjasper-dev
Install the library used by opencv.
Here sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103
seems to change depending on the version
If you get an error, you may be able to break through by changing the *** of sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-***
.
next
sudo pip3 --default-timeout=1000 install opencv-python
Put opencv by.
When I run it in this state, I get the above error
Here because I got the same error I ran the destination of the link that was posted. First run this in the terminal
LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1
Then edit with vim
vim.tiny .bashrc
export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1 #Add this sentence
vim saves with : wq
from edit mode ʻESC in ʻa
and exits.
If you make a mistake, exit without saving with : q!
From ʻESC`.
Finally
source .bashrc
Apply with
I will check it
$ python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.1'
It is certainly installed.
Recommended Posts