我有一个装有 Ubuntu 的 Raspberry pi 4B,我正在尝试使用 PiCamera 和虚拟环境(否则我将无法安装外部软件包)将相机模块 3 与 python 一起使用(我已经使用 Raspberry Pi OS 测试了代码,所以我知道它是正确的)。但是,当我运行代码时,它显示:
Traceback (most recent call last):
File "/home/flamethrower/Desktop/CameraCode/headshots_picam.py", line 2, in <module>
from picamera import PiCamera
File "/home/flamethrower/cameravenv/lib/python3.11/site-packages/picamera/__init__.py", line 72, in <module>
from picamera.exc import (
File "/home/flamethrower/cameravenv/lib/python3.11/site-packages/picamera/exc.py", line 41, in <module>
import picamera.mmal as mmal
File "/home/flamethrower/cameravenv/lib/python3.11/site-packages/picamera/mmal.py", line 49, in <module>
_lib = ct.CDLL('libmmal.so')
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: libmmal.so: cannot open shared object file: No such file or directory
------------------
(program exited with code: 1)
我试过测试代码,但结果还是一样。我该怎么办?
答案1
它抱怨找不到。使用 查找提供libmmal.so
的包。使用 安装该包。libmmal.so
dpkg -S libmmal.so
apt install package-name