我试图通过MS DevOps使用yaml管道运行一个简单的bash脚本。我想使用Python版本3.8。当通过SSH连接到自托管代理时,我能够毫无问题地运行yaml文件中指定的脚本。但是,当我通过管道运行脚本时,它失败了,因为出于某种原因,python
别名引用的是Python 2.7.17
我尝试在agentsvc
用户的.bashrc
和bash.bashrc
文件中设置以下别名:alias python='python3.8'
我意识到我可以在脚本中将python
更改为python3.8
,但是我不想这样做。有人知道为什么alias不能在管道环境中工作吗?我能做些什么来解决这个问题
以下是我正在尝试运行的yaml管道示例:
pool: myubuntuagent
trigger:
- master
steps:
- script: |
# install pre-requisites
whoami
python -V
python -m pip install -r requirements.txt
workingDirectory: '$(System.DefaultWorkingDirectory)'
displayName: 'Install Prerequisites etc. etc. etc.'
作为一种解决方法,我们可以尝试在cmd下面使用Python3.x版本
结果:
此外,我们还可以使用任务
Use Python version
来指定python版本。您可以参考此doc来配置自托管代理以使用此任务结果:
相关问题 更多 >
编程相关推荐