I need to run a Python script in an Azure Pipeline, for this I was thinking of using Python script with inline code, previously I needed to install the packages, so far so good.
The problem is that I can't use or install Python, when I can install it (in the self hosted agent), the python
or pip
command is not available. Has anyone experienced this? I can't even use UsePython extension.
I need to run a Python script in an Azure Pipeline, for this I was thinking of using Python script with inline code, previously I needed to install the packages, so far so good.
The problem is that I can't use or install Python, when I can install it (in the self hosted agent), the python
or pip
command is not available. Has anyone experienced this? I can't even use UsePython extension.
Have you considered using Microsoft-hosted agents? Python and pip are already included.
You can then select one of the pre-installed versions of Python using the UsePythonVersion@0 task.
I tested the UsePythonVersion@0 task in my self-hosted agent, it will download the correct version I specified on the agent.
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12.1'
architecture: 'x64'
- script: |
python --version
version check: