【问题标题】:ModuleNotFoundError: No module named 'firebase_admin'ModuleNotFoundError:没有名为“firebase_admin”的模块
【发布时间】:2021-12-14 20:04:01
【问题描述】:

我目前在我的 venv 中为 Google Cloud Firestore 的 vscode 导入模块时遇到问题。

import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore

pip -V 显示 python 3.8。 python -V 显示 Python 3.8.1。 使用 pip freeze,模块出现在这里。

firebase-admin==5.0.3

无论如何它会返回

ModuleNotFoundError: No module named 'firebase_admin'

我也试过from google.cloud import firestore,但它返回ModuleNotFoundError: No module named 'google.cloud'

这里有什么帮助吗?

【问题讨论】:

  • 您是否在正确的虚拟环境中安装了模块?
  • 应该是!我检查了 pip show firebase-admin ,它显示它安装在 venv 文件夹中

标签: python firebase google-cloud-firestore google-cloud-functions python-venv


【解决方案1】:

通过在 python 终端中运行来修复它。不知何故,在 python 中使用运行代码会导致此错误。可能是由于interpeter配置问题

【讨论】: