Azure Function App 中的 while 运行 python 脚本中没有名为 'requests' 的模块错误
No module named 'requests' Error in while running python script in Azure Function App
我在 VS Code 中创建了一个 python 项目,并将其部署在 Azure Functions 上,其中包含所有必需的文件,例如 requirements.txt。
代码在我的本地计算机上成功 运行 但当我在 Azure 函数上 运行 时出现错误“没有名为 'requests' 的模块”。
我的 requirements.txt 文件包含以下元素:
天蓝色函数
请求
PyJWT
密码学
那么有什么方法可以在 Azure Functions Linux VM 上手动安装此包。我正在使用 Azure 函数的消费计划
Code is running successfully on my local machine but giving error when I am running it on Azure Function as "No module named 'requests'".
你的function
可以在本地运行成功,说明requests
已经安装
你可以尝试使用这个命令来生成你的requirements.txt
,以防你自己创建的requirements.txt
是错误的:
pip freeze > requirements.txt
然后您可以尝试重新部署,如果不成功,您可以尝试使用此命令部署您的function
:
func azure functionapp publish <function app name> --build remote
<function app name>
是你的 Azure Function App
在你的 Azure Portal
中的名字。
我在 VS Code 中创建了一个 python 项目,并将其部署在 Azure Functions 上,其中包含所有必需的文件,例如 requirements.txt。 代码在我的本地计算机上成功 运行 但当我在 Azure 函数上 运行 时出现错误“没有名为 'requests' 的模块”。 我的 requirements.txt 文件包含以下元素:
天蓝色函数
请求
PyJWT
密码学
那么有什么方法可以在 Azure Functions Linux VM 上手动安装此包。我正在使用 Azure 函数的消费计划
Code is running successfully on my local machine but giving error when I am running it on Azure Function as "No module named 'requests'".
你的function
可以在本地运行成功,说明requests
已经安装
你可以尝试使用这个命令来生成你的requirements.txt
,以防你自己创建的requirements.txt
是错误的:
pip freeze > requirements.txt
然后您可以尝试重新部署,如果不成功,您可以尝试使用此命令部署您的function
:
func azure functionapp publish <function app name> --build remote
<function app name>
是你的 Azure Function App
在你的 Azure Portal
中的名字。