最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Run Python script on Azure DevOps with Classic UI - Stack Overflow

programmeradmin0浏览0评论

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.

Share Improve this question edited Feb 4 at 1:03 Bruno Silva asked Feb 3 at 20:32 Bruno SilvaBruno Silva 611 silver badge10 bronze badges 3
  • Please note that Azure != Azure DevOps. You might want to change the title of your post. – Rui Jarimba Commented Feb 3 at 22:00
  • Hi, can you explain more about " I can't even use UsePython extension." Do you mean using the UsePythonVersion@0 task in the pipeline? If it is, is there any error messages when you use it or screenshots you can share to better check the issue? – Miao Tian-MSFT Commented Feb 4 at 4:32
  • Hi, can you please check the answer and use UsePythonVersion@0 task in your pipeline? – Miao Tian-MSFT Commented Feb 27 at 7:38
Add a comment  | 

2 Answers 2

Reset to default 0

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:

发布评论

评论列表(0)

  1. 暂无评论