使用Python的Azure函数应用程序的“ ModuleNotFoundError”

时间:2019-06-11 14:37:20

标签: python azure python-import azure-function-app

我不断收到错误

  

ModuleNotFoundError:没有名为“ 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
        )

对此有任何帮助!

1 个答案:

答案 0 :(得分:1)

您是否将pip安装在您的python环境中?

pip install azure