I setted up the same environment as you:
- Anaconda 4.0 installed into
C:\Users\user\Anaconda
- OpenAlpr installed into
C:\Users\user\Downloads\openalpr-2.3.0-win-64bit
So I can call python
from the console (cmd
) and get:
Python 2.7.11 |Anaconda 4.0.0 (64-bit)
...
The module
As the bindings are not shipped with the pre-compiled Windows binaries, you have to install the module manually:
- download the GitHub repo as ZIP;
- extract the archive to a temporary folder, let's say
C:\Users\user\Downloads\openalpr-master
;
- Python binding is into the
C:\Users\user\Downloads\openalpr-master\src\bindings\python
folder;
- open a console into this directory and type
python setup.py install
Voilà, the Python module OpenAlpr is installed!.
Call python_test.bat
from the OpenAlpr directory to see it works.
Usage
To be able to import OpenAlpr module from Python, two solutions.
Solution 1: you will need to work into the OpenAlpr directory where DLL files are located.
Then, it should works as expected:
>>> from openalpr import Alpr
>>> alpr = Alpr('us', 'openalpr.conf', 'runtime_data')
>>> alpr.is_loaded()
True
Solution 2 (best I think): you update the PATH
to include the OpenAlpr folder:
>>> from os import environ
>>> alpr_dir ='C:\Users\user\Downloads\openalpr-2.3.0-win-64bit\openalpr_64'
>>> environ['PATH'] = alpr_dir + ';' + environ['PATH']
>>> from openalpr import Alpr
>>> alpr = Alpr('us', alpr_dir + '/openalpr.conf', alpr_dir + '/runtime_data')
>>> alpr.is_loaded()
True