让Ant构建错误:不能运行程序和QUOT;蟒蛇" [英] getting Ant build error: Cannot run program "python"

查看:282
本文介绍了让Ant构建错误:不能运行程序和QUOT;蟒蛇"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是构建文件:

 < EXEC可执行=蟒蛇failonerror =真>
  < ARG行=$ {} installer.izpack.dir /utils/wrappers/izpack2exe/izpack2exe.py/>
  < ARG行= - 文件= $ {BASEDIR} /installer/EasyIT-installer.jar/>
  < ARG行= - 输出= $ {BASEDIR} /installer/EasyIT-installer.exe/>
  < ARG行= - 无UPX/>
< / EXEC>

和输出:

 构建失败
E:\\ Java项目\\星火计划项目\\ EastIT - 复制\\编译\\的build.xml:873:执行失败:java.io.IOException异常:不能运行程序蟒蛇(目录E:\\ Java项目\\星火计划项目\\ EastIT - 复制):CreateProcess的错误= 2,系统找不到指定的文件
        在java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        在java.lang.Runtime.exec(Runtime.java:615)
        在org.apache.tools.ant.taskdefs.Execute $ Java13CommandLauncher.exec(Execute.java:8 62)
        在org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
        在org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
        在org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
        在org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
        在org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
        在org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        在sun.reflect.GeneratedMethodAccessor15.invoke(来源不明)
        在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja VA:43)
        在java.lang.reflect.Method.invoke(Method.java:601)
        在org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        在org.apache.tools.ant.Task.perform(Task.java:348)
        在org.apache.tools.ant.Target.execute(Target.java:392)
        在org.apache.tools.ant.Target.performTasks(Target.java:413)
        在org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        在org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        在org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        在org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        在org.apache.tools.ant.Main.runBuild(Main.java:811)
        在org.apache.tools.ant.Main.startAnt(Main.java:217)
        在org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        在org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
java.io.IOException异常:引起CreateProcess的错误= 2,系统找不到指定的文件
        在java.lang.ProcessImpl.create(本机方法)
        在java.lang.ProcessImpl<&初始化GT;(ProcessImpl.java:189)
        在java.lang.ProcessImpl.start(ProcessImpl.java:133)
        在java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
        ... 23更多
总时间:50秒


解决方案

确保蟒蛇是在你正在运行的版本,或指定一个绝对的路径路径在 EXEC 任务,你的Python可执行文件。

查看针对任何具体说明, EXEC任务的文档使用Windows还是没有窗口。需要注意的是有你提到的具体错误:


  

一个常见的​​问题是没有在PATH可执行文件。如果你得到一个错误信息不能运行程序...:CreateProcess的错误= 2。该系统找不到指定的路径。看看你的PATH变量。只需直接在命令行中输入命令,如果Windows找到它,蚂蚁也应该这样做。 (否则,请在用户邮件列表寻求帮助。)如果Windows不能执行程序添加PROGRAMM的目录到PATH(设置PATH =%PATH%; dirOfProgram),或在您的构建文件的可执行属性指定的绝对路径。


This is the build file:

<exec executable="python" failonerror="true">
  <arg line="${installer.izpack.dir}/utils/wrappers/izpack2exe/izpack2exe.py"/>
  <arg line="--file=${basedir}/installer/EasyIT-installer.jar"/>
  <arg line="--output=${basedir}/installer/EasyIT-installer.exe"/>
  <arg line="--no-upx"/>
</exec>

And the output:

BUILD FAILED
E:\Java Projects\Spark Projects\EastIT - Copy\build\build.xml:873: Execute failed: java.io.IOException: Cannot run program "python" (in directory "E:\Java Projects\Spark Projects\EastIT - Copy"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        at java.lang.Runtime.exec(Runtime.java:615)
        at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:8 62)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at org.apache.tools.ant.Target.performTasks(Target.java:413)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java :41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:811)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
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>(ProcessImpl.java:189)
        at java.lang.ProcessImpl.start(ProcessImpl.java:133)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
        ... 23 more


Total time: 50 seconds

解决方案

Make sure that python is in the PATH where you're running the build, or specify an absolute path to your python executable in the exec task.

Review the docs for the exec task for any specific instructions on using windows vs. not-windows. Note that your specific error is mentioned there:

A common problem is not having the executable on the PATH. In case you get an error message Cannot run program "...":CreateProcess error=2. The system cannot find the path specified. have a look at your PATH variable. Just type the command directly on the command line and if Windows finds it, Ant should do it too. (Otherwise ask on the user mailinglist for help.) If Windows can not execute the program add the directory of the programm to the PATH (set PATH=%PATH%;dirOfProgram) or specify the absolute path in the executable attribute in your buildfile.

这篇关于让Ant构建错误:不能运行程序和QUOT;蟒蛇&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆