Jenkins无法识别从.BAT文件运行的Python

时间:2019-06-15 07:19:22

标签: jenkins path

我是Jenkins的初学者,并尝试从Windows的Jenkins批处理命令运行一个小的Python代码。

但是,构建运行会引发以下错误:

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已安装在我的计算机中,并且也在环境变量中声明。我想念什么?

1 个答案:

答案 0 :(得分:1)

Running as SYSTEM”表示Jenkins服务不是 与您的帐户一起运行,而是Windows system account,用作service account

这意味着您需要将Python路径添加到system environment variables,而不是用户路径。