"ModuleNotFoundError" 使用 Azure 函数的应用程序使用 Python

"ModuleNotFoundError" with Azure function Apps using Python

我一直收到错误

ModuleNotFoundError: No module named 'azure'

对于第 4 行,我 import azure.functions as func 下面是使用此 tutorial

设计的我的初始化文件的代码
import logging
import azure.functions as func

def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.params.get('name')
    if not name:
        try:
            req_body = req.get_json()
        except ValueError:
            pass
        else:
            name = req_body.get('name')

    if name:
        return func.HttpResponse(f"Hellod {name}!")

    else:
        return func.HttpResponse(
             "Please pass a name on the query string or in the request body",
             status_code=400
        )

如有任何帮助,我们将不胜感激!

您是否在 python 环境中 pip 安装了库?

pip install azure