本文介绍了自托管代理上的Azure DevOps Python Pipeline Agent.ToolsDirectory错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自托管代理,上面安装了Python3.8.我可以访问代理并为我的python包运行管道.我收到与错误版本不匹配的Agent.ToolsDirectory错误.

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.

这是它输出的日志:

推荐答案

任务使用Python版本将不会使用托管代理的本地计算机上安装的python.它将在 Agent.ToolsDirectory . Python 3.8未包含在 Microsoft托管的代理程序,它不包含在Agent.ToolsDirectory中.

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.

为了使用在本地计算机上安装的python版本.您要么需要指向cmd任务中的python.exe物理路径.或在powershell任务中手动将python.exe路径添加到环境变量路径.请检查以下示例.

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.

要在Powershell任务中使用本地python:

To use local python in powershell task:

$env:Path += ";c:\{local path to}\Python\Python38\; c:\{local path to}\Python\Python38\Scripts\"
python -V

c:\{local path to}\Python\Python38\python.exe -V
c:\{local path to}\Python\Python38\Scripts\pip.exe install

要在CMD任务中使用python:

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

这篇关于自托管代理上的Azure DevOps Python Pipeline Agent.ToolsDirectory错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 20:22