Running openalpr using python in windows

449 views Asked by At

I created an environment and installed openalpr using pip install openalpr followed by downloading the openalpr from https://github.com/openalpr/openalpr/releases and installing python binding using command python setup.py install

The code which I tried to run was:

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")

And I'm getting error as given below

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'

Please help me to solve this.

0

There are 0 answers