使用ant构建工具构建错误“不能打开文件C:\程序”:[Errno 2]没有这样的文件或目录”

时间:2022-02-23 20:52:10

i configured python to path variable, below is the path variable content

我将python配置为path变量,下面是路径变量内容。

%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0\;C:\Python27\;c:\program files\java\jdk1.7.0_03\bin;.;c:\program files\tortoisesvn\bin;d:\apache-ant-1.8.3\bin;c:\program files\ibm\gsk8\lib;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;%M2_HOME%\bin;C:\Program Files\Lenovo\Bluetooth Software\;

why i configured python means, iam creating exe file using ant build and installj

为什么我配置了python,我使用ant构建和installj创建exe文件?

<target name="installer.izpack.exe" depends="installer.izpack" description="build release executable izpack installer">
    <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>
</target>

but when building the app getting below error, please can anyone help in resolving this.

但是当构建应用程序出错时,请帮忙解决这个问题。

installer.izpack.exe:
     [exec] python: can't open file 'C:\Program': [Errno 2] No such file or directory

BUILD FAILED
E:\Java Projects\Spark Projects\EastIT - Copy\build\build.xml:873: exec returned: 2

Total time: 51 seconds

1 个解决方案

#1


1  

You have a path with a space in it, e.g.

你有一条有空间的路径。

c:\program files\java\jdk1.7.0_03\bin

You have to quote the path, like this:

你必须引用路径,像这样:

"c:\program files\java\jdk1.7.0_03\bin"

Not 100% sure about Python, but this should work:

对于Python,不是100%肯定,但这应该可以:

%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0\;C:\Python27\;"c:\program files\java\jdk1.7.0_03\bin";.;c:\program files\tortoisesvn\bin;d:\apache-ant-1.8.3\bin;c:\program files\ibm\gsk8\lib;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;%M2_HOME%\bin;"C:\Program Files\Lenovo\Bluetooth Software\";

% systemroot % \ system32系统;% systemroot % % systemroot % \ system32系统\ wbem;% systemroot % \ system32系统\ windowspowershell \ v1.0 \;C:\ Python27 \;“c:\ program files \ java \ jdk1.7.0_03 \ bin”;;c:\ tortoisesvn \ bin \程序文件;d:\ apache-ant-1.8.3 \ bin,c:\ program files \ ibm \ gsk8 \ lib,c:\ ibm \ SQLLIB \ bin \ PROGRA ~ 1;c:\ \ ibm \ SQLLIB \ PROGRA ~ 1功能;c:\ \ ibm \ SQLLIB \ SAMPLES \ PROGRA ~ 1 REPL;% M2_HOME % \ bin。“C:\ Program Files \联想\蓝牙软件\”;

Notice that some of your path components are shortened to be 8.3 length compatible (they have a ~ in them). If you don't like the quoting or it doesn't work for Python, you can use the command

注意,您的一些路径组件被缩短为8.3长度兼容(它们有一个~)。如果您不喜欢引用,或者它不适合Python,您可以使用该命令。

dir /x

dir / x

to get the shortened version of each path component, e.g. on my system

获取每个路径组件的缩短版本,例如在我的系统上。

06/12/2012  09:09 AM    <DIR>          PROGRA~1     Program Files
06/12/2012  09:08 AM    <DIR>          PROGRA~2     Program Files (x86)

#1


1  

You have a path with a space in it, e.g.

你有一条有空间的路径。

c:\program files\java\jdk1.7.0_03\bin

You have to quote the path, like this:

你必须引用路径,像这样:

"c:\program files\java\jdk1.7.0_03\bin"

Not 100% sure about Python, but this should work:

对于Python,不是100%肯定,但这应该可以:

%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0\;C:\Python27\;"c:\program files\java\jdk1.7.0_03\bin";.;c:\program files\tortoisesvn\bin;d:\apache-ant-1.8.3\bin;c:\program files\ibm\gsk8\lib;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;%M2_HOME%\bin;"C:\Program Files\Lenovo\Bluetooth Software\";

% systemroot % \ system32系统;% systemroot % % systemroot % \ system32系统\ wbem;% systemroot % \ system32系统\ windowspowershell \ v1.0 \;C:\ Python27 \;“c:\ program files \ java \ jdk1.7.0_03 \ bin”;;c:\ tortoisesvn \ bin \程序文件;d:\ apache-ant-1.8.3 \ bin,c:\ program files \ ibm \ gsk8 \ lib,c:\ ibm \ SQLLIB \ bin \ PROGRA ~ 1;c:\ \ ibm \ SQLLIB \ PROGRA ~ 1功能;c:\ \ ibm \ SQLLIB \ SAMPLES \ PROGRA ~ 1 REPL;% M2_HOME % \ bin。“C:\ Program Files \联想\蓝牙软件\”;

Notice that some of your path components are shortened to be 8.3 length compatible (they have a ~ in them). If you don't like the quoting or it doesn't work for Python, you can use the command

注意,您的一些路径组件被缩短为8.3长度兼容(它们有一个~)。如果您不喜欢引用,或者它不适合Python,您可以使用该命令。

dir /x

dir / x

to get the shortened version of each path component, e.g. on my system

获取每个路径组件的缩短版本,例如在我的系统上。

06/12/2012  09:09 AM    <DIR>          PROGRA~1     Program Files
06/12/2012  09:08 AM    <DIR>          PROGRA~2     Program Files (x86)