質問
【Google Colab】Vision APIで『レシートOCR』
を参考に,Google Vision APIを使ってみたいと考えているのですが,
以下のimportの段階でエラーが出てしまいます.
インストールし直してみたり,Vision APIを使用するのに必要な準備もやっているのですが,改善されません.
どう直したら良いのか教えていただきたいです.
--------------------------------------------------------------------------- ImportError Traceback (most recent call last) Input In [208], in <cell line: 10>() 6 os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/Users/satoryosuke/Downloads/ferrous-gate-362103-ea6dff9700bf.json" 7 import io ---> 10 from google.cloud import vision_v1 File ~/opt/anaconda3/lib/python3.9/site-packages/google/cloud/vision_v1/__init__.py:20, in <module> 1 # -*- coding: utf-8 -*- 2 # 3 # Copyright 2020 Google LLC (...) 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 18 from __future__ import absolute_import ---> 20 from google.cloud.vision_helpers.decorators import add_single_feature_methods 21 from google.cloud.vision_helpers import VisionHelpers 22 import sys File ~/opt/anaconda3/lib/python3.9/site-packages/google/cloud/vision_v1/services/image_annotator/__init__.py:16, in <module> 1 # -*- coding: utf-8 -*- 2 # Copyright 2022 Google LLC 3 # (...) 14 # limitations under the License. 15 # ---> 16 from .client import ImageAnnotatorClient 17 from .async_client import ImageAnnotatorAsyncClient 19 __all__ = ( 20 "ImageAnnotatorClient", 21 "ImageAnnotatorAsyncClient", 22 ) File ~/opt/anaconda3/lib/python3.9/site-packages/google/cloud/vision_v1/services/image_annotator/client.py:39, in <module> 37 from google.api_core import operation # type: ignore 38 from google.api_core import operation_async # type: ignore ---> 39 from google.cloud.vision_v1.types import image_annotator 40 from .transports.base import ImageAnnotatorTransport, DEFAULT_CLIENT_INFO 41 from .transports.grpc import ImageAnnotatorGrpcTransport ImportError: cannot import name 'image_annotator' from 'google.cloud.vision_v1.types' (/Users/satoryosuke/opt/anaconda3/lib/python3.9/site-packages/google/cloud/vision_v1/types.py)
該当のソースコード
Python
1import os 2os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "サービスアカウントキーのパス" 3import io 4 5 6from google.cloud import vision_v1 7
補足情報(FW/ツールのバージョンなど)
jupyter notebookを使用しています

回答2件
あなたの回答
tips
プレビュー