树莓派使用cv2报错

By Heanny
2020-05-20
736 read

错误

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

解决办法

在python前面加上

LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1

LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1 python3


每次使用cv2都要加,永久的解决办法还不清除,有直到的童鞋告知一下
更多可见https://github.com/piwheels/packages/issues/59

linux下python程序KILLED记录
flask插件之使用flask_caching缓存

Comments

Heanny #1

有人说

Seems you can add "export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1" to the file .bashrc in home directory, follow this by "source .bashrc". After making this mod, launch Python3 and then import cv2 and you will get no error.

个人试了一下不行,你们可以试试。 但是

Be careful. This solution is really dangerous and loads the libatomic library into every binary that you run...

Leave a Reply