无法执行";python-mpy_compile";康德

无法执行";python-mpy_compile";康德,python,jenkins,jenkins-pipeline,Python,Jenkins,Jenkins Pipeline,我是python新手,我尝试从git编译一些开源代码,并使用jenkins管道执行一些shell脚本 我的詹金斯密码: pipeline { agent any stages { stage("Git-Clone") { steps{ git 'https://github.com/Vsb19/simple-python-pyinstaller-app.g

我是python新手,我尝试从git编译一些开源代码,并使用jenkins管道执行一些shell脚本

我的詹金斯密码:

pipeline
{
    agent any
    stages
    {
        stage("Git-Clone")
        
        {
            steps{
            git 'https://github.com/Vsb19/simple-python-pyinstaller-app.git'
            }
        }
        stage('Shell scripts')
        {
            steps
            {
                sh  'python -m py_compile sources/add2vals.py sources/calc.py'
            }
            
        }
        
    }
}
跑步后,我会遇到如下问题:

[Pipeline] sh
+ python -m py_compile sources/add2vals.py sources/calc.py
/var/lib/jenkins/workspace/sample-python@tmp/durable-b12d65e6/script.sh: 1: python: not found
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE

我在我的UbuntuVM中安装了java、python、pip和Jenkins

可能是python的可执行文件不在Jenkins用户的
$PATH
中。使用完整路径可以解决此问题,例如:

sh  '/usr/bin/python -m py_compile sources/add2vals.py sources/calc.py'

试过了,现在我发现这个问题了“/var/lib/jenkins/workspace/sample-python@tmp/持久-d7f733b6/script.sh:2:/var/lib/python:权限被拒绝”