Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkins无法运行程序“;python“;CreateProcess错误=2,系统找不到指定的文件_Python_Jenkins - Fatal编程技术网

Jenkins无法运行程序“;python“;CreateProcess错误=2,系统找不到指定的文件

Jenkins无法运行程序“;python“;CreateProcess错误=2,系统找不到指定的文件,python,jenkins,Python,Jenkins,当我使用Jenkins在python脚本下面运行时,它抛出了下面的错误 Jenkins Cannot run program "python" CreateProcess error=2, The system cannot find the file specified 下面是我的代码,当我直接执行它时,它可以工作 import _mssql,os,datetime if (os.getenv('ColumnName').isspace() or not os.getenv('ColumnN

当我使用Jenkins在python脚本下面运行时,它抛出了下面的错误

Jenkins Cannot run program "python" CreateProcess error=2, The system cannot find the file specified
下面是我的代码,当我直接执行它时,它可以工作

import _mssql,os,datetime
if (os.getenv('ColumnName').isspace() or not os.getenv('ColumnName')):
    print("White space Entered")
else:
    print(var)
我正在运行Python 3.5

多谢各位

尝试python-v并得到相同的错误

The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "python" (in directory "D:\test\"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:245)
    at hudson.Proc$LocalProc.<init>(Proc.java:214)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:846)
    at hudson.Launcher$ProcStarter.start(Launcher.java:384)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:108)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:65)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1729)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:404)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    ... 16 more
Build step 'Execute Python script' marked build as failure
Finished: FAILURE
系统找不到指定的文件
致命:命令执行失败
java.io.IOException:无法运行程序“python”(在目录“D:\test\”中):CreateProcess error=2,系统找不到指定的文件
位于java.lang.ProcessBuilder.start(未知源)
在hudson.Proc$LocalProc.(Proc.java:245)
在hudson.Proc$LocalProc.(Proc.java:214)
位于hudson.Launcher$LocalLauncher.launch(Launcher.java:846)
位于hudson.Launcher$ProcStarter.start(Launcher.java:384)
在hudson.tasks.commandexplorer.perform(commandexplorer.java:108)
在hudson.tasks.commandexplorer.perform(commandexplorer.java:65)
在hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
位于hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
位于hudson.model.Build$BuildExecution.Build(Build.java:205)
位于hudson.model.Build$BuildExecution.doRun(Build.java:162)
位于hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
位于hudson.model.Run.execute(Run.java:1729)
运行(FreeStyleBuild.java:43)
在hudson.model.ResourceController.execute(ResourceController.java:98)
运行(Executor.java:404)
原因:java.io.IOException:CreateProcess error=2,系统找不到指定的文件
在java.lang.ProcessImpl.create(本机方法)
位于java.lang.ProcessImpl。(未知源)
位于java.lang.ProcessImpl.start(未知源)
... 还有16个
生成步骤“执行Python脚本”将生成标记为失败
完成:失败

上述错误与您的python代码无关

将以下内容添加到您的Jenkins工作中:

set PATH=<Python Installation Path>;%PATH%
python <Complete path to your script>
设置路径=;%路径%
python

上述错误与您的python代码无关

将以下内容添加到您的Jenkins工作中:

set PATH=<Python Installation Path>;%PATH%
python <Complete path to your script>
设置路径=;%路径%
python

在jenkins作业中,不要执行上面的脚本,而是执行以下命令-“python-V”。如果执行成功,则以-python的形式执行此脚本“你的代码是不相关的。无法找到python可执行文件,因为它不在路径中。尝试回显jenkins的路径。得到相同的错误。jenkin作业正在哪台计算机上执行?Windows还是Linux?我正在Windows计算机上运行,并确认路径已添加到env变量中。在jenkins作业中,不执行上述脚本,而是执行此命令-“python-V”。如果执行成功,则以-python的形式执行此脚本“你的代码是不相关的。无法找到python可执行文件,因为它不在路径中。尝试回显jenkins的路径。得到相同的错误。jenkin作业正在哪台计算机上执行?Windows或Linux?我正在Windows计算机上运行,并确认路径已添加到环境变量中。问题不在于我的脚本或环境变量。我认为Jenkins插件与Python3.5版本有问题。我试着运行与Jenkins提供的windows批处理文件相同的命令,结果成功了。(PythonD:\test.py)我想在Jenkins控制台下编写脚本并运行它们,不管怎么做。问题不在于我的脚本或环境变量。我认为Jenkins插件与Python3.5版本有问题。我试着运行与Jenkins提供的windows批处理文件相同的命令,结果成功了。(Pythond:\test.py)我想在Jenkins控制台下编写脚本并运行它们,知道怎么做吗。