PythonでGoogleのDriveAPIを用いてOCR(光学文字認識)を実行できる「google-drive-ocr」のインストールについて解説しています。
「google-drive-ocr」モジュール・ライブラリは、Google DriveAPIv3を使用し、OCR(光学文字認識)を実行することができます。
■Python
今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)
■google-drive-ocrをインストールする
google-drive-ocrをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。
pip install google-drive-ocr
起動後、上記のコマンドを入力し、Enterキーを押します。
なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。
py -3.8 -m pip install google-drive-ocr
切り替えるために、上記のコマンドを入力し、Enterキーを押します。
Defaulting to user installation because normal site-packages is not writeable
Collecting google-drive-ocr
Downloading google_drive_ocr-0.2.1-py2.py3-none-any.whl (12 kB)
Collecting ConfigArgParse==1.4.1
Downloading ConfigArgParse-1.4.1-py3-none-any.whl (19 kB)
Requirement already satisfied: attrs==21.2.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-drive-ocr) (21.2.0)
Collecting google-api-python-client==2.9.0
Downloading google_api_python_client-2.9.0-py2.py3-none-any.whl (7.0 MB)
|████████████████████████████████| 7.0 MB 6.8 MB/s
Collecting google-auth-oauthlib==0.4.1
Downloading google_auth_oauthlib-0.4.1-py2.py3-none-any.whl (18 kB)
Collecting natsort==7.0.1
Downloading natsort-7.0.1-py3-none-any.whl (33 kB)
Collecting tqdm==4.60.0
Downloading tqdm-4.60.0-py2.py3-none-any.whl (75 kB)
|████████████████████████████████| 75 kB 1.5 MB/s
Requirement already satisfied: pdf2image==1.15.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-drive-ocr) (1.15.1)
Requirement already satisfied: httplib2<1dev,>=0.15.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client==2.9.0->google-drive-ocr) (0.19.1)
Requirement already satisfied: six<2dev,>=1.13.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client==2.9.0->google-drive-ocr) (1.15.0)
Requirement already satisfied: google-api-core<2dev,>=1.21.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client==2.9.0->google-drive-ocr) (1.30.0)
Requirement already satisfied: google-auth-httplib2>=0.1.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client==2.9.0->google-drive-ocr) (0.1.0)
Requirement already satisfied: uritemplate<4dev,>=3.0.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client==2.9.0->google-drive-ocr) (3.0.1)
Requirement already satisfied: google-auth<2dev,>=1.16.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client==2.9.0->google-drive-ocr) (1.32.1)
Requirement already satisfied: requests-oauthlib>=0.7.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-auth-oauthlib==0.4.1->google-drive-ocr) (1.3.0)
Requirement already satisfied: pillow in c:\users\user_\appdata\roaming\python\python38\site-packages (from pdf2image==1.15.1->google-drive-ocr) (8.2.0)
Requirement already satisfied: pyparsing<3,>=2.4.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from httplib2<1dev,>=0.15.0->google-api-python-client==2.9.0->google-drive-ocr) (2.4.7)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (1.53.0)
Requirement already satisfied: packaging>=14.3 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (20.9)
Requirement already satisfied: protobuf>=3.12.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (3.17.3)
Requirement already satisfied: setuptools>=40.3.0 in c:\program files\python38\lib\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (47.1.0)
Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (2.25.1)
Requirement already satisfied: pytz in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (2021.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-auth<2dev,>=1.16.0->google-api-python-client==2.9.0->google-drive-ocr) (0.2.8)
Requirement already satisfied: rsa<5,>=3.1.4; python_version >= “3.6” in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-auth<2dev,>=1.16.0->google-api-python-client==2.9.0->google-drive-ocr) (4.7.2)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-auth<2dev,>=1.16.0->google-api-python-client==2.9.0->google-drive-ocr) (4.2.2)
Requirement already satisfied: oauthlib>=3.0.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib==0.4.1->google-drive-ocr) (3.1.1)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (2021.5.30)
Requirement already satisfied: idna<3,>=2.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client==2.9.0->google-drive-ocr) (1.26.5)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in c:\users\user_\appdata\roaming\python\python38\site-packages (from pyasn1-modules>=0.2.1->google-auth<2dev,>=1.16.0->google-api-python-client==2.9.0->google-drive-ocr) (0.4.8)
Installing collected packages: ConfigArgParse, google-api-python-client, google-auth-oauthlib, natsort, tqdm, google-drive-ocr
Attempting uninstall: google-api-python-client
Found existing installation: google-api-python-client 2.11.0
Uninstalling google-api-python-client-2.11.0:
Successfully uninstalled google-api-python-client-2.11.0
Attempting uninstall: google-auth-oauthlib
Found existing installation: google-auth-oauthlib 0.4.5
Uninstalling google-auth-oauthlib-0.4.5:
Successfully uninstalled google-auth-oauthlib-0.4.5
Attempting uninstall: tqdm
Found existing installation: tqdm 4.61.1
Uninstalling tqdm-4.61.1:
Successfully uninstalled tqdm-4.61.1
Successfully installed ConfigArgParse-1.4.1 google-api-python-client-2.9.0 google-auth-oauthlib-0.4.1 google-drive-ocr-0.2.1 natsort-7.0.1 tqdm-4.60.0
Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、google-drive-ocrが正常にインストールされたことになります。
なお、今回はgoogle-drive-ocrのバージョン0.2.1をインストールしました。
コメント