首先,我从这里下载了 OpenALPR src 和二进制文件: Release ( src & binary )
在 C:\OpenALPR 中提取 src 和二进制文件,然后我将 C:\OpenALPIR\openalpr_64 添加到我的路径(环境变量 -> 路径 -> 编辑 -> 新建),然后我从 src/bindings/python 运行 follownig 命令
c:\OpenALPR\openalpr-2.3.0\src\bindings\python>python setup.py build
running build
running build_py
creating build
creating build\lib
creating build\lib\openalpr
copying openalpr\openalpr.py -> build\lib\openalpr
copying openalpr\__init__.py -> build\lib\openalpr
c:\OpenALPR\openalpr-2.3.0\src\bindings\python>python setup.py install
running install
running build
running build_py
running install_lib
running install_egg_info
Removing C:\Users\Danial\AppData\Local\Programs\Python\Python36\Lib\site-packages\openalpr-1.0-py3.6.egg-info
Writing C:\Users\Danial\AppData\Local\Programs\Python\Python36\Lib\site-packages\openalpr-1.0-py3.6.egg-info
之后,我将目录更改为 alpr 所在的目录。
c:\OpenALPR\openalpr-2.3.0\src\bindings\python>cd c:\OpenALPR\openalpr_64
我跑了 python_test.bat
c:\OpenALPR\openalpr_64>python_test.bat
Traceback (most recent call last):
File "C:\Users\Danial\AppData\Local\Programs\Python\Python36\lib\site-packages\openalpr\openalpr.py", line 51, in __init__
self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalprpy.dll")
File "C:\Users\Danial\AppData\Local\Programs\Python\Python36\lib\ctypes\__init__.py", line 426, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Danial\AppData\Local\Programs\Python\Python36\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "python/test.py", line 21, in <module>
alpr = Alpr(options.country, options.config, options.runtime_data)
File "C:\Users\Danial\AppData\Local\Programs\Python\Python36\lib\site-packages\openalpr\openalpr.py", line 61, 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: <bound method Alpr.__del__ of <openalpr.openalpr.Alpr object at 0x000001D89B9B2D68>>
Traceback (most recent call last):
File "C:\Users\Danial\AppData\Local\Programs\Python\Python36\lib\site-packages\openalpr\openalpr.py", line 258, in __del__
File "C:\Users\Danial\AppData\Local\Programs\Python\Python36\lib\site-packages\openalpr\openalpr.py", line 135, in is_loaded
AttributeError: 'Alpr' object has no attribute 'loaded'
Press any key to continue . . .
但是,如果我从 src 文件夹运行 test.py,即:
C:\OpenALPR\openalpr-2.3.0\src\bindings\python>python test.py -c us --config "c:\OpenALPR\openalpr_64\openalpr.conf" --runtime_data "c:\OpenALPR\openalpr_64\runtime_data" c:\OpenALPR\openalpr_64\samples\us-1.jpg
Using OpenALPR 2.3.0
Image size: 497x372
Processing Time: 1258.149048
Plate #1
Plate Confidence
- THECAR 92.207481
- THEGAR 81.348961
- HECAR 80.229317
- TMECAR 78.159492
- THE0AR 77.702461
- THECAB 77.389000
- THEAR 76.510017
该错误是由于 openalprpy.dll 我从二进制文件夹复制 openalprpy.dll 并粘贴到 Python\Python36\Lib\site-packages\openalpr 这已经解决了问题,但我认为它不是故意的?