开发者社区> 问答> 正文

jenkins 执行python script报错?报错

在jenkins中使用python 插件执行脚本时报错

python 的环境变量已经配置。 若用shell执行python 脚本是ok

[workspace] $ python "D:\Program Files\Apache Software Foundation\Tomcat 6.0\temp\hudson8762080438361983685.py"
FATAL: command execution failed java.io.IOException: Cannot run program "python" (in directory "D:\jenkins\jobs\testexample\workspace"): CreateProcess error=2, ?????????
	at java.lang.ProcessBuilder.start(Unknown Source)
	at hudson.Proc$LocalProc.<init>(Proc.java:244)
	at hudson.Proc$LocalProc.<init>(Proc.java:216)
	at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:776)
	at hudson.model.Build$BuildExecution.build(Build.java:203)
	at hudson.model.Build$BuildExecution.doRun(Build.java:160)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)
	at hudson.model.Run.execute(Run.java:1738)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:381)
Caused by: java.io.IOException: CreateProcess error=2, ?????????
	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

展开
收起
爱吃鱼的程序员 2020-06-10 13:49:18 1102 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    我怀疑是权限问题。

    java.io.IOException:CreateProcesserror=2,


    建议使用

    路径下面的 c:/python2.7/python.exe d:/aaaaaaa.py


    回复 @Echo:我的意思是直接在jenkins里面写python的时候替换成带路径的我的路径d:/Python27/python.exe这个设置了。像是jenkins搜书不到path里面我配置的这个地址这样测试一下试试看

    请问怎么解决的??非常感谢

    2020-06-10 13:49:35
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载