gpt4 book ai didi

python-3.x - TimeTrigger Azure Function 在 Azure 门户中没有模块错误,但在 VSC 中运行良好

转载 作者:行者123 更新时间:2023-12-02 07:00:28 24 4
gpt4 key购买 nike

我已在 Visual Studio Code 中成功创建了 Azure 时间触发器。

我在上传到 Azure 门户之前在 VSC 中对其进行了测试,并且运行正常

enter image description here

当我在 Azure 中运行它时,它给我一个错误 no module name; enter image description here

我已经回去尝试在 .venv 中安装模块,并且模块存在。

如何解决这个问题?

最佳答案

Azure云上的功能将根据requirements.txt安装模块。因此,当您将功能从本地部署到azure门户时,如果您没有将模块添加到requirements.txt,则本地安装的模块也不会安装在azure云上。 。您可以运行以下命令将所有模块添加到requirements.txt中自动:

pip freeze > requirements.txt

然后运行func azure functionapp publish <funciton app name on azure> --build remote将函数从本地部署到azure。

关于python-3.x - TimeTrigger Azure Function 在 Azure 门户中没有模块错误,但在 VSC 中运行良好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64674515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com