I have a self-hosted agent that has Python3.8 installed on it. I can access the agent and run the pipeline for my python package. I get an error with the Agent.ToolsDirectory not matching the right version.
This is the log it outputs:
Task Use Python version will not use the python installed in your local machine which hosts your agent. It will search the Python versions in Agent.ToolsDirectory. Python 3.8 is not included in Microsoft-hosted agents, and it is not included in Agent.ToolsDirectory.
In order to use the python version installed in your on-premise machine. You either need to point to the python.exe physical path in cmd task. Or add the python.exe path to environment variable path manually in powershell task. Please check below example.
To use local python in powershell task:
$env:Path += ";c:\{local path to}\Python\Python38\; c:\{local path to}\Python\Python38\Scripts\"
python -V
Or
c:\{local path to}\Python\Python38\python.exe -V
c:\{local path to}\Python\Python38\Scripts\pip.exe install
To use python in CMD task:
c:\{local path to}\Python\Python38\python.exe -V
c:\{local path to}\Python\Python38\Scripts\pip.exe install