我正在尝试使用 Raspbian 4.19 和 Python 3.7 在我的 Raspberry Pi 上安装 OpenALPR。
我按照本指南安装 OpenAlpr,从 CLI 调用它时工作正常。我现在正试图让它在一个小的 python 脚本中工作,但我什至无法加载 OpenAlpr。我的代码:
from openalpr import Alpr
import json
import sys
from time import sleep
alpr = Alpr("eu", "/etc/openalpr/openalpr.conf",
"/usr/share/openalpr/runtime_data")
analysis = alpr.recognize_file("./500front.jpg")
print(json.dumps(analysis, indent=4))
当运行出现sudo python3 testscript.py
以下错误时:
Traceback (most recent call last):
File "testingcamera.py", line 6, in <module>
"/usr/share/openalpr/runtime_data")
File "/usr/local/lib/python3.7/dist-packages/openalpr/openalpr.py", line 85, in __init__
self._recognize_raw_image_func = self._openalprpy_lib.recognizeRawImage
File "/usr/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/libopenalprpy.so: undefined symbol: recognizeRawImage
Exception ignored in: <function Alpr.__del__ at 0x76598198>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/openalpr/openalpr.py", line 258, in __del__
if self.is_loaded():
File "/usr/local/lib/python3.7/dist-packages/openalpr/openalpr.py", line 135, in is_loaded
if not self.loaded:
AttributeError: 'Alpr' object has no attribute 'loaded'