The article is written to share how to deploy and configure your custom version of Python in Windows App Service.
Before you continue reading the detailed steps of how to use custom version of Python, please notice:
Run the python-3.8.8-amd64.exe in my local windows machine：
Make sure check to install pip
Compress the whole Python388 folder to Python38.zip
Inside the zip file, it should contains all the following contents
You can see the new “Python38” folder being generated.
Sample applicationhost.xdt file contents:
<?xml version="1.0"?> <configuration xmlns:xdt= http://schemas.microsoft.com/XML-Document-Transform> <system.webServer> <runtime xdt:Transform="InsertIfMissing"> <environmentVariables xdt:Transform="InsertIfMissing"> <add name="PATH" value="%HOME%\Python388\;%PATH%" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" /> </environmentVariables> </runtime> </system.webServer> </configuration>
Then Restart the Web App.Every time you Restart the web app, the platform will check your D:\home\sites\applicationhost.xdt file, use it to transfer the D:\local\Config\applicationhost.config.
The transform logs are all recorded in D:\home\LogFiles\Transform, you can check the timestamp and file name to get the latest log.
Check your D:\local\Config\applicationhost.config file, should see Python path being added as the “PATH” environment variables.
In the Kudu Powershell console, use “python -V” to check Python version. You should be able to see the customer Python version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.