gpt4 book ai didi

python - undefined symbol : __atomic_fetch_add_8

转载 作者:行者123 更新时间:2023-12-01 17:24:35 26 4
gpt4 key购买 nike

我正在尝试在我的树莓派上的 thonny python IDE 上测试我的 picamera,但出现错误:

Traceback (most recent call last):
File "/home/pi/Documents/Camera_test.py", line 2, in <module>
import cv2
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
module = self._original_import(*args, **kw)
File "/home/pi/.local/lib/python3.7/site-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 305, in _custom_import
module = self._original_import(*args, **kw)
ImportError: /home/pi/.local/lib/python3.7/site-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8

我已经尝试寻找可能的解决方案,但无法做到这一点,因为我无法理解他们试图对 -latomic 说些什么。我对此还很陌生。

import numpy as np
import cv2

cap = cv2.VideoCapture(0)
cap.set(3,640) # set Width
cap.set(4,480) # set Height

while(True):
ret, frame = cap.read()
frame = cv2.flip(frame, -1) # Flip camera vertically
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

cv2.imshow('frame', frame)
cv2.imshow('gray', gray)

k = cv2.waitKey(30) & 0xff
if k == 27: # press 'ESC' to quit
break

cap.release()
cv2.destroyAllWindows()

最佳答案

使用正确版本的 OpenCV contrib。

pip install opencv-contrib-python==4.1.0.25

参见 this 末尾的答案邮政。

关于python - undefined symbol : __atomic_fetch_add_8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58778865/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com