zaidabuhijleh
zaidabuhijleh

Reputation: 231

Python not working in Azure pipeline build VM

Im trying to run a python script in an Azure pipeline, but it doesnt seem to be working. It keeps telling me 'python' is not recognized as an internal or external command, operable program or batch file. I have installed python and added it to the path, when I type python in the command line on the VM it works: enter image description here

But when I try to run the following command line task in the pipeline, it fails:

- task: CmdLine@2
  inputs:
    script: 'python ./tools/setPythonClientVersion.py $(Build.BuildNumber)'
  displayName: Set Client Version

I get the following error:

enter image description here

Any idea as to why this is happening?

Upvotes: 1

Views: 1158

Answers (1)

DavidCox88
DavidCox88

Reputation: 1018

I encountered a similar issues and solved it by adding the python interpreter argument to the yaml. Something like this:

- task: PythonScript@0
  displayName: Set Client Version
  inputs:
    scriptSource: inline
    script: |
     # add your script here
    pythonInterpreter: 'c:/python/python.exe'

Upvotes: 1

Related Questions