我创建了一个环境并安装了 openalpr,pip install openalpr
然后从https://github.com/openalpr/openalpr/releases下载了 openalpr并使用命令安装了 python 绑定python setup.py install
我试图运行的代码是:
from openalpr import Alpr
alpr = Alpr("eu", 'openalpr.conf', 'runtime_data')
if not alpr.is_loaded():
print("Error loading OpenALPR")
sys.exit(1)
alpr.set_top_n(1)
alpr.set_default_region("eu")
我收到如下错误
Traceback (most recent call last):
File "C:\Users\Blaster\project\lib\site-packages\openalpr\openalpr.py", line 70, in __init__
self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalpr.dll")
File "c:\python\python38\lib\ctypes\__init__.py", line 451, in LoadLibrary
return self._dlltype(name)
File "c:\python\python38\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'libopenalpr.dll' (or one of its dependencies). Try using the full path with constructor syntax.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "vidOpenALPR.py", line 5, in <module>
alpr = Alpr("eu", 'openalpr.conf', 'runtime_data')
File "C:\Users\Blaster\project\lib\site-packages\openalpr\openalpr.py", line 80, in __init__
raise nex
OSError: Unable to locate the OpenALPR library. Please make sure that OpenALPR is properly installed on your system and that the libraries are in the appropriate paths.
Exception ignored in: <function Alpr.__del__ at 0x0000026F50D28DC0>
Traceback (most recent call last):
File "C:\Users\Blaster\project\lib\site-packages\openalpr\openalpr.py", line 159, in __del__
File "C:\Users\Blaster\project\lib\site-packages\openalpr\openalpr.py", line 212, in is_loaded
AttributeError: 'Alpr' object has no attribute 'loaded'
请帮我解决这个问题。