It seems that you are using Hosted agent vs2017-win2016
and we can see that the Python version installed by the agent does not contain Python 3.4
Check the task prerequisites:
- A Microsoft-hosted agent with side-by-side versions of Python installed, or a self-hosted agent with Agent.ToolsDirectory configured (see FAQ).
This task will fail if no Python versions are found in Agent.ToolsDirectory. Available Python versions on Microsoft-hosted agents can be found here.
As a workaround, we should install the Python 3.4 via command line and then use the task Use Python version to specify the Python version. Check this doc for more details.
Update1
It seems that we cannot install 3.4 in the hosted agent.
TEST1 install python via power shell script:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri "{URL}" -OutFile "$(Build.SourcesDirectory)/{python install file .exe}"
$(Build.SourcesDirectory)/{python install file .exe} /quiet InstallAllUsers=0 PrependPath=1 Include_test=0
But cannot found python 3.4 exe file in the download website.
TEST2 install the python via extension.
Extension: Python build tools
Task: Install Python on Windows
According to the json file, we can see that 3.5.2 is the lowest version.