在Cygwin sh中从Maven调用Python

2024-10-01 22:42:37 发布

您现在位置:Python中文网/ 问答频道 /正文

从Cygwin shell(Windows上的bash通过Cygwin)构建Maven时,/usr/bin的路径解析不正确。在

让我解释一下。Cygwin附带Python,可以通过/usr/bin的符号链接访问它。Maven应该可以访问这个符号链接,因为它的位置在PATH环境变量中。Cygwin将/usr/bin添加到PATH环境变量中。但是,Maven无法找到Python。E、 g

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project cloud-devcloud: Command execution failed. Cannot run program "python" (in directory "C:\cygwin\home\myuser\incubator-cloudstack\tools\devcloud"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

但Python在那里:

^{pr2}$

尽管是个象征。在

$ ls -al /usr/bin/python
lrwxrwxrwx 1 donall Domain Users 13 Sep 19 11:38 /usr/bin/python -> python2.6.exe

Python是符号链接的问题吗?或者Maven不能访问/usr/bin中的文件?在


Tags: thetopathrunorgbin链接usr
1条回答
网友
1楼 · 发布于 2024-10-01 22:42:37

看起来maven是作为一个常规的Windows原生应用程序运行的,而不是一个“cygwin感知应用程序”(如果存在这样的东西:-)

这由内部使用的路径指示,该路径打印在日志中:C:\cygwin\home\myuser\incubator cloudstack\tools\devcloud

因此,在定位python可执行文件时,来自Maven的调用将无法识别cygwin路径。一种可能的解决方案是添加包含python.exe到系统路径(即Windows PATH变量)

相关问题 更多 >

    热门问题