我正在测试 Google 的 Natural Language API,但这条线
from google.cloud import language_v1
抛出以下错误
ModuleNotFoundError: No module named 'google'
我正在使用诗歌,我的pyproject.toml包含 google-cloud
[tool.poetry]
name = "cocoon"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
[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 的这些文档。
有类似的问题(如this或this),但到目前为止还没有解决方案对我有用。因为我使用的是诗歌,所以我没有使用那里概述的 venv 。我还仔细检查了 VSCode 解释器是否正确。