from picamera import PiCamera
在buildroot生成的Linux映像上的python3.7中给出以下错误。赞赏有关如何修复的建议。谢谢!
/usr/bin/python3.7: symbol 'mmal_port_pool_create': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_list_push_front': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_list_destroy': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_rational_to_fixed_16_16': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_status_to_string': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_list_push_back': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_list_create': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_list_insert': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_rational_equal': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_list_pop_front': can't resolve symbol
/usr/bin/python3.7: symbol 'mmal_port_type_to_string': can't resolve symbol
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/picamera/__init__.py", line 72, in <module>
from picamera.exc import (
File "/usr/lib/python3.7/site-packages/picamera/exc.py", line 41, in <module>
import picamera.mmal as mmal
File "/usr/lib/python3.7/site-packages/picamera/mmal.py", line 49, in <module>
_lib = ct.CDLL('libmmal.so')
File "/usr/lib/python3.7/ctypes/__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen() error
答案 0 :(得分:0)
您需要选择rpi-userland
软件包。
我假设您是在Raspberry Pi上工作,否则picamera并不是您的开始。
picamera尝试打开libmmal.so共享库。 rpi-userland
Buildroot软件包将下载,构建和安装该库。
如果您为python-picamera
制作了一个Buildroot软件包,则应将select BR2_PACKAGE_RPI_USERLAND
添加到其Config.in
文件中,并复制rpi-userland软件包的依赖项。在python-picamera.mk
文件中,您应该添加PYTHON_PICAMERA_DEPENDENCIES += rpi-userland
。这样可以确保在启用picamera时始终选择并构建该软件包。
另外,如果您有一个有效的python-picamera
软件包,请考虑在contribution guidelines之后向上游发送。
如果您没有为python-picamera
制作Buildroot软件包,则可能是问题的根源。 PyPI的picamera软件包与libmmal的特定版本链接,该版本可能与Buildroot中的版本不同。这可能会导致您在导入模块时看到错误。
答案 1 :(得分:0)
FWIW我最终只是使用raspistill ...
raspistill_params = (' -n'
+ ' -ISO ' + str(iso)
+ ' -ss ' + str(shutter_speed)
+ ' -mm ' + meter_mode
+ ' -ex ' + exposure_mode
+ ' --ev ' + str(exposure_compensation)
+ ' -awb ' + awb_mode
+ ' -br ' + str(brightness)
+ ' -co ' + str(contrast)
+ ' -sa ' + str(saturation)
+ ' -sh ' + str(sharpness)
+ ' -drc ' + drc_strength
+ ' -rot ' + str(rotation)
+ ' -q ' + str(quality)
+ ' -w ' + str(width)
+ ' -h ' + str(height)
+ ' -ae ' + str(annotate_text_size) + ',0xff,0x808000 '
+ ' -a "' + annotate_text + '"'
+ ' -x GPS.GPSLatitudeRef=' + exif_lat_ref(latitude)
+ ' -x GPS.GPSLatitude=' + exif_latlong(latitude)
+ ' -x GPS.GPSLongitudeRef=' + exif_long_ref(longitude)
+ ' -x GPS.GPSLongitude=' + exif_latlong(longitude)
+ ' -o ' + filename
)
proc = subprocess.Popen("raspistill " + raspistill_params, shell=True, stdout=subprocess.PIPE)
ret_val = proc.communicate()
答案 2 :(得分:-1)
sudo apt-get update
sudo apt-get upgrade
sudo raspi-config