ModuleNotFoundError: No module named 'icalendar' google Cloud

ModuleNotFoundError: No module named 'icalendar' google Cloud

在 Gcloud 上部署 运行 google 应用程序后,我收到“ModuleNotFoundError: No module named 'icalendar'”,我已经使用 pip 安装了 icalendar 模块,但令我惊讶的是我收到了一个错误当我尝试部署应用程序时。我在这上面花了几个小时,非常感谢你的帮助。

请问。检查 pip list 以查看是否已正确安装。如果是,请。检查 python 终端中的导入语句。

如果可行,则使用 which python 并确保它与您正在安装的虚拟环境相同,运行 来自。

根据官方文档:

Specifying Dependencies

Dependencies for Python applications are declared in a standard requirements.txt

例如:

Flask==0.10.1
icalendar

因此我创建了一个 requirements.txt 并包含了 icalendar 模块。然后我部署到 App Engine gcloud app deploy,一切都按预期工作。

您可以按照本教程更好地理解这个概念:

Quickstart for Python 3 in the App Engine Standard Environment