我尝试了许多教程和安装来使用带有Python的rapsberry 4 picamera我正在使用picamera库,每次我使用这个简单的脚本或任何picamera脚本来尝试相机时,我都会收到以下错误消息:
mmal: mmal_component_create_core: could not find component 'vc.camera_info'
Traceback (most recent call last):
File "/home/pi/Desktop/ex.py", line 6, in <module>
camera = PiCamera()
File "/home/pi/.virtualenvs/cv450/lib/python3.9/site-packages/picamera/camera.py", line 367, in __init__
with mo.MMALCameraInfo() as camera_info:
File "/home/pi/.virtualenvs/cv450/lib/python3.9/site-packages/picamera/mmalobj.py", line 2346, in __init__
super(MMALCameraInfo, self).__init__()
File "/home/pi/.virtualenvs/cv450/lib/python3.9/site-packages/picamera/mmalobj.py", line 631, in __init__
mmal_check(
File "/home/pi/.virtualenvs/cv450/lib/python3.9/site-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.camera_info': Function not implemented
我使用的代码是:
from time import sleep
from picamera import PiCamera
camera = PiCamera()
camera.resolution = (1024, 768)
camera.start_preview()
sleep(2)
camera.capture('foo.jpg')
感谢的帮助
原因可能有很多。。。您可能未能在raspi-config
中配置某些内容,可能修补了config.txt
中的GPU内存分割,可能存在权限问题,可能存在软件冲突/不兼容。
我认为你需要做一些老式的侦查。我会:
-
试着用内置
raspistill
拍照,以确保您的相机、电缆和硬件是正确的 -
尝试删除并重新安装或更新PiCamera包
-
试着更明确地使用带有shebang 的Python3
-
尝试使用不同的相机和/或电缆和/或Raspberry Pi
-
尝试制作树莓派操作系统的单独新安装