AttributeError: module 'firebase_admin.firestore' has no attribute 'AsyncClient'

AttributeError: module 'firebase_admin.firestore' has no attribute 'AsyncClient'

我在我的应用程序中使用 Firestore 并尝试在 Firestore 上使用 Python (Async) 到 运行 操作。

我使用的是官方文档中给出的例子here
我在 运行ning db = firestore.AsyncClient().

时收到以下错误
root@54ec5947a266:/usr/src/app# python3 test.py 
Traceback (most recent call last):
  File "test.py", line 69, in <module>
    test()
  File "test.py", line 60, in test
    db = firestore.AsyncClient()
AttributeError: module 'firebase_admin.firestore' has no attribute 'AsyncClient'
root@54ec5947a266:/usr/src/app#

似乎找不到 AsyncClient

root@5e2f7f6fc19c:/usr/src/app# python3
Python 3.5.3 (default, Apr  5 2021, 09:00:41) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from firebase_admin import firestore
>>> 'AsyncClient' in dir(firestore)
False
>>> 

如果我在这里遗漏了什么,你能指导我吗?

AsyncClient 确实存在于 python 的 firestore 子模块中:

>>> from firebase_admin import firestore
>>> 'AsyncClient' in dir(firestore)
True

确保您已正确安装 python 的 firease 管理库,并为您的 python 和 pip 版本使用 firebase-admin installation guide.
(例如 pip3 install --user firebase-admin)