pythonazure

How to change python version of azure function


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?


Solution

    • 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.