我使用 ubuntu arch 64 位在 raspberry pi 上安装了 picamera2。但是,当我导入 picamera2 时,我遇到了这个错误。似乎该问题仅发生在 raspberry pi 上。
>>> import picamera2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ahmad/.local/lib/python3.10/site-packages/picamera2/__init__.py", line 1, in <module>
from .configuration import CameraConfiguration, StreamConfiguration
File "/home/ahmad/.local/lib/python3.10/site-packages/picamera2/configuration.py", line 1, in <module>
from .controls import Controls
File "/home/ahmad/.local/lib/python3.10/site-packages/picamera2/controls.py", line 4, in <module>
from libcamera import ControlType, Size, Rectangle
ModuleNotFoundError: No module named 'libcamera'
有什么建议吗?提前谢谢您!
答案1
此答案基于https://libcamera.org/getting-started.html
首先,安装依赖项。
sudo apt install build-essential meson ninja libyaml-dev python3-yaml python3-ply python3-jinja2 libssl-dev openssl git
然后,下载源代码,
git clone https://git.libcamera.org/libcamera/libcamera.git
进入目录,
cd libcamera
并编译。
meson build
sudo ninja -C build install