【问题标题】:Failed to import Cloud Firestore library for Python无法为 Python 导入 Cloud Firestore 库
【发布时间】:2020-06-04 23:08:16
【问题描述】:

我正在尝试创建一个 python 脚本来从我的 Cloud Firestore 数据库中获取数据。 但是我收到了这个奇怪的错误:

import firebase_admin
from firebase_admin import credentials, firestore

Exception has occurred: ImportError
Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.
  File "C:\Users\Alexandru\Desktop\python\hello.py", line 10, in <module>
    from firebase_admin import credentials, firestore

我想我已经安装了所有的包

pip list
    
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Package                  Version
------------------------ ----------
astroid                  2.4.1
autopep8                 1.5.3
CacheControl             0.12.6
cachetools               4.1.0
certifi                  2020.4.5.1
cffi                     1.14.0
chardet                  3.0.4
colorama                 0.4.3
cryptography             2.9.2
firebase                 3.0.1
firebase-admin           4.3.0
google-api-core          1.18.0
google-api-python-client 1.9.1
google-auth              1.16.1
google-auth-httplib2     0.0.3
google-cloud-core        1.3.0
google-cloud-firestore   1.7.0
google-cloud-storage     1.28.1
google-resumable-media   0.5.1
googleapis-common-protos 1.52.0
grpcio                   1.29.0
httplib2                 0.18.1
idna                     2.9
isort                    4.3.21
jwcrypto                 0.7
lazy-object-proxy        1.4.3
mccabe                   0.6.1
msgpack                  1.0.0
pip                      20.1.1
protobuf                 3.12.2
pyasn1                   0.4.8
pyasn1-modules           0.2.8
pycodestyle              2.6.0
pycparser                2.20
pylint                   2.5.2
python-firebase          1.2
python-jwt               3.2.6
pytz                     2020.1
requests                 2.23.0
rsa                      4.0
setuptools               41.2.0
six                      1.15.0
toml                     0.10.1
uritemplate              3.0.1
urllib3                  1.25.9
wrapt                    1.12.1

【问题讨论】:

  • 在 Stack Overflow 上,请勿分享代码和文字的图片。将文本复制到问题本身中,并对其进行格式化,以便于阅读、复制和搜索。
  • 谢谢,我编辑了问题
  • 能分享一下pip list的输出吗
  • 我也加了点子列表

标签: python firebase google-cloud-firestore


【解决方案1】:

重新安装 pip,它对我有用:

python -m pip install --upgrade --force-reinstall pip

【讨论】:

    猜你喜欢
    • 2022-01-23
    • 2018-06-24
    • 2021-12-06
    • 2021-01-01
    • 1970-01-01
    • 2020-11-07
    • 1970-01-01
    • 2012-08-11
    • 1970-01-01
    相关资源
    最近更新 更多