【问题标题】:How to change python version of azure functionHow to change python version of azure function
【发布时间】:2022-12-27 17:07:38
【问题描述】:

When I publish my azure cloud functions I get the message:

Local python version '3.9.7' is different from the version expected for your deployed Function App. This may result in 'ModuleNotFound' errors in Azure Functions. Please create a Python Function App for version 3.9 or change the virtual environment on your local machine to match 'Python|3.8'.

How can I change the version to 3.9?

【问题讨论】:

    标签: python azure


    【解决方案1】:
    • You can view and set the linuxFxVersion from the Azure CLI.
    • With the az functionapp config set command, you can change the linuxFxVersion setting in the function app.
    az functionapp config set --name <FUNCTION_APP> --resource-group <RESOURCE_GROUP> --linux-fx-version "PYTHON|3.9"
    

    Please refer Changing Python version for more information.

    【讨论】:

    • I have the same issue, but I do not have the permission to update config(to python3.9). So I try to install python3.7. And run deployment with func azure functionapp publish &lt;func_name&gt; --publish-local-settings -i --overwrite-settings -y --python. Same error occurred. I also got this error message "Unexpected character encountered while parsing value: {. Path '[0].build_summary', line 1, position 663." Any suggestions?
    • I'm getting '3.9' is not recognized as an internal or external command, operable program or batch file.
    【解决方案2】:

    For those of you facing the following error when attempting the solution provided by Harshitha:

    '3.9' is not recognized as an internal or external command,
    

    operable program or batch file.

    This is because '|' needs to be escaped within the string "PYTHON|3.9" to work in PowerShell. This will work:

    'Python"|"3.9'

    【讨论】:

      猜你喜欢
      • 2022-12-27
      • 2022-12-01
      • 2022-12-01
      • 2022-12-02
      • 2022-12-01
      • 2022-12-01
      • 2022-12-27
      • 2022-12-02
      • 2022-12-27
      相关资源
      最近更新 更多