@xutpuu commented on Feb 28, 2019, 12:57 PM UTC:
I add Python task and wrote inline script to run on self-hosted pool. In the build it failed with error "Parameter 'toolPath' cannot be null or empty." I tried to add tool "Use Python Version" but I can't undetstand where I should add $AGENT_TOOLSDIRECTORY.
I installed Python on build machine and added python to PATH.
⚠_Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking._
This issue was moved by davidstaheli from MicrosoftDocs/vsts-docs#3514.
@colindomoney commented on Mar 17, 2019, 11:22 AM UTC:
I had a similar issue - I ended up doing a local install of Python 3.6.5 from source using the --prefix option to locate this inside my _work/_tool directory. I also had to create a symlink to python3 to python or I got the above message. I'll write this up in detail and post here - it is possible to get this to work.
@davidstaheli commented on Jul 5, 2019, 6:49 PM UTC:
Thanks for reporting this. We're going to move this issue to this repo:
https://github.com/Microsoft/azure-pipelines-tasks
/move to Microsoft/azure-pipelines-tasks
@xutpuu Are you still having this issue?
The PythonScript task will take in an optional path for pythonInterpreter or attempt to find python on the path
Can you verify that you added python to the path (and not python3 or something similar)?
You can also just try inputting the path to where your python is installed using the pythonInterpreter input option.
Let me know if that helps
I had the same issue. The solution for me was to explicitly set the Python interpreter path in the task.

https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
Ctrl+F "use python version"
Or maybe use a conda enviroment:
Closing this out with an action item to improve docs. Re-open if you still see this is an issue
Most helpful comment
I had the same issue. The solution for me was to explicitly set the Python interpreter path in the task.