jump to:all–mastodon–bluesky–lemmy–lobsters–dev–stack–wiki–rss–hn
wwebbit
view: | | |
stack

CreateProcess error=2, Can not run program "python" on Ant

5 public replies · showing 5 · fetched 0s ago · read only

  1. SubOptimal · 9y ago

    edit python.exe must be in a directory defined in the executable path variable PATH . Following working example assumes the presence of C:\Python33\python.exe <project name="demo" default="main" basedir="."> <property environment="env" /> <echo>PATH is set as: ${env.PATH}</echo> <target name="main"> <exec dir="backend/generated" executable="python"> <arg line="--version"/> </exec> </target> </project> execute in a command session set PATH=C:\Python33;%PATH% ant output Buildfile: X:\temp\build.xml [echo] PATH is set as: C:\Python33;... ... main: [exec] Python 3.3.0 edit Just checked. The executable can be executable="python" or executable="python.exe" . So @cdarke is right the issue is that python.exe is not in PATH .

  2. cdarke · 9y ago

    Check that your %path% environment variable contains the directory that python.exe resides in.

  3. any · 9y ago

    @cdarke my Path value is C:\Program Files\Java\jdk1.8.0\bin;C:\Program Files\pl\bin;C:\Python22 and my python.exe is in C:\Python22

  4. Kasun Kodagoda · 9y ago

    Formatted the code.

  5. zorze · 8y ago

    stackoverflow.com/questions/47952935/… Only this worked for me!