まず、ここから OpenALPR src とバイナリをダウンロードしました: Release ( src & binary )
C:\OpenALPR で src とバイナリを抽出し、その後 C:\OpenALPIR\openalpr_64 をパスに追加し (環境変数 -> パス -> 編集 -> 新規)、src/bindings/python から次のコマンドを実行しました。
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 に貼り付けました。これで問題は解決しましたが、意図したものではないと思いますか?