代码之家  ›  专栏  ›  技术社区  ›  Anubhav Dhawan

ImportError:无法导入Python的云Firestore库

  •  10
  • Anubhav Dhawan  · 技术社区  · 8 年前

    试图在python服务器上集成Google firestore API

    ...
      File "/home/daffolap-355/repos/subscriptions/appvendor/firebase_admin/firestore.py", line 28, in <module>
        raise ImportError('Failed to import the Cloud Firestore library for Python. Make sure '
    ImportError: Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.
    

    我在这里得到这个错误:

    from firebase_admin import credentials, auth, firestore

    我安装了 firebase-admin 模块:

    pip install --upgrade -t libs firebase-admin

    并运行应用程序

    dev_appserver app.yaml

    4 回复  |  直到 8 年前
        1
  •  8
  •   Chayapol    6 年前

    Google云Firestore需要 grpc .

    pip install grpcio
    

    但是,根据您的操作系统,还有其他步骤。退房 https://github.com/grpc/grpc/tree/master/src/python/grpcio

        2
  •  7
  •   MAGA PILL    8 年前

    要解决“google cloud firestore”模块错误,请执行以下操作:

    • pip安装google cloud core
    • pip安装google云firestore

    然后像这样导入:

    • 导入操作系统
    • 导入firebase\u管理
    • 从firebase\u管理导入 资格证书
    • 来自谷歌。云导入firestore
    • 来自firebase\u admin 导入firestore
        3
  •  3
  •   Ravneet Sohi    6 年前

    这对我有用。 尝试卸载并重新安装google cloud firestore

    1. 使用pip卸载“google cloud firestore”

         pip uninstall google-cloud-firestore
      
    2. 再次使用pip重新安装

         pip install google-cloud-firestore
      
        4
  •  2
  •   Shashank Singh    6 年前

    在windows上安装firebase\u管理库时,我遇到了类似的问题。 解决方案是将protobuf库降级到3.6.0。

    pip install protobuf==3.6