【问题标题】:Jenkins Slave on Windows詹金斯奴隶在 Windows
【发布时间】:2020-10-22 22:20:54
【问题描述】:

我有一个新要求,将 Windows 10 VM 配置为 Jenkins Slave 并运行某些 python 脚本。 我目前正在使用多分支管道并使用 Jenkins 文件来定义不同的阶段。

问题: Jenkins 无法识别 python 在哪里: F:\Jenkins\workspace\test>python --version
未找到 Python,但可以从 Microsoft Store 安装:https://go.microsoft.com/fwlink?linkID=2082640

Python 在命令行中工作,但不是在 Jenkins 中工作。 F:\Jenkins\workspace\test>python --version Python 3.8.5

我尝试在 Jenkins 的管理节点部分定义 PYTHONPATH 变量(在 windows 配置下),但它仍然无法识别它。

有什么建议吗??

jenkinsfile : 
 stage('Lint') {
            steps {
                script {
                    bat '''
                      python --version
                      // C:\Python\python.exe --version  
                      // Tried to run the executable but no luck 
                      '''
                }

【问题讨论】:

  • Jenkins 用户是否具有 Python 的可执行权限。请检查一次权限。

标签: python jenkins


【解决方案1】:

由于在 Windows 上安装某些东西(例如:java)后需要重新启动命令行才能成功调用它,所以我的赌注是重新启动 Jenkins

【讨论】:

    猜你喜欢
    • 2018-11-11
    • 1970-01-01
    • 1970-01-01
    • 2015-07-25
    • 2018-08-02
    • 2018-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多