ModuleNotFoundError:使用自然语言时没有名为“google”的模块

问题描述

我正在测试来自 Google 的 Natural Language API,但是这一行

from google.cloud import language_v1

抛出以下错误

ModuleNotFoundError: No module named 'google'

我正在使用 Poetry 并且我的 pyproject.toml 包含 google-cloud

[tool.poetry]
name = "cocoon"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
pandas = "^1.2.3"
app-store-scraper = "^0.3.5"
google-cloud-language = "^2.0.0"
google-api-python-client = "^2.0.2"
google-cloud = "^0.34.0"
fsspec = "^0.8.7"

[tool.poetry.dev-dependencies]
pytest = "^5.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

我关注的内容基于 Google 的 these docs

有类似的问题(例如 thisthis),但到目前为止没有任何解决方案对我有用。我没有使用 venv as outlined there,因为我使用的是 Poetry。我还仔细检查了 VSCode 解释器是否正确。

VSCode Python interpreter

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)