Jenkins无法识别从.BAT文件运行的Python [英] Jenkins couldn't recognize Python run from .BAT file
本文介绍了Jenkins无法识别从.BAT文件运行的Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Jenkins的初学者,并试图从Windows的Jenkins批处理命令运行一个小的Python代码.
I'm a beginner to Jenkins, and trying to run a small Python code from Jenkins batch command for Windows.
但是,构建运行会引发以下错误:
However, the build run throws below error:
Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\PythonProject1
[PythonProject1] $ cmd /c call C:\Windows\TEMP\jenkins7865401366299588301.bat
C:\Program Files (x86)\Jenkins\workspace\PythonProject1>cd C:\Users\Ben\Desktop\py
C:\Users\Ben\Desktop\py>python C:\Users\Ben\Desktop\py\for.py
'python' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Ben\Desktop\py>exit 9009
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Python已安装在我的计算机中,并且也在环境变量中声明.我想念什么?
Python is installed in my machine and is declared in Environment Variable too. What am I missing?
推荐答案
"Running as SYSTEM
"表示Jenkins服务不是在您的帐户中运行,而是服务帐户.
"Running as SYSTEM
" means the Jenkins service is not running with your account, but the Windows system account, used as a service account.
这意味着您需要将python路径添加到系统环境变量,而不是用户变量.
That means you need to add python path to the system environment variables, not the user ones.
这篇关于Jenkins无法识别从.BAT文件运行的Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文