Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/124.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkins刷新环境变量以使Python插件工作_Jenkins_Jenkins Plugins - Fatal编程技术网

Jenkins刷新环境变量以使Python插件工作

Jenkins刷新环境变量以使Python插件工作,jenkins,jenkins-plugins,Jenkins,Jenkins Plugins,我正在尝试让Jenkins job为我安装python,然后使用python插件执行脚本 到目前为止,我得到了python并安装得很好,我还为python设置了环境变量,但是插件不会启动: 系统找不到指定的文件致命:命令执行 失败的java.io.IOException:无法运行程序“python”(在目录中 “C:\Jenkins\workspace\install and configure python”):CreateProcess 错误=2,系统找不到指定的文件 据我所知,发生这种情况

我正在尝试让Jenkins job为我安装python,然后使用python插件执行脚本

到目前为止,我得到了python并安装得很好,我还为python设置了环境变量,但是插件不会启动

系统找不到指定的文件致命:命令执行 失败的java.io.IOException:无法运行程序“python”(在目录中 “C:\Jenkins\workspace\install and configure python”):CreateProcess 错误=2,系统找不到指定的文件

据我所知,发生这种情况是因为python.exe不在路径中。所以我试过:
1) 将其添加到批内的路径-失败
2) 使用environment Injector插件添加到作业中的PATH变量以“为运行准备环境”-失败

因此,我猜测我必须重置节点的java.library.path或重新启动Jenkins从属代理

问题:有什么办法可以做到吗

以下是迄今为止我为python安装提供的“Windows批处理命令”:

::verify installation is needed
python --version
if %errorlevel% EQU 0 EXIT 0

:: get the wget utility
cscript.exe .\web\vbs\download-wget.vbs

::get python 27 from server
wget.exe --no-check-certificate https://qaa.myserver.com/public/python27/python-2.7.3.msi

::install python
msiexec /i python-2.7.3.msi /qn TARGETDIR=c:\Python27

::because of the stupid bug https://issues.jenkins-ci.org/browse/JENKINS-3425
set temppath=%PATH:"=%
setx PATH "%temppath%" /m

在这之后,我将通过Python插件执行第二个构建步骤
打印“Hello,World”

为什么要这样做?便携性?您刚刚在脚本中硬编码了python位置。。。这不利于环境的可移植性。如果python丢失,我建议使构建失败。如果您希望在每个构建上安装新的python,请尝试virtualenv@Sammyrulez,以便于配置。如果我需要另一个从机,我可以在它上面运行这个作业,然后运行真正的测试(需要python和它的很多库)。其次,对安装路径进行硬编码一点也不麻烦,因为我正在将相同的路径添加到path变量中,任何进一步的调用都只是
python some.py
——不管python在哪里。这有意义吗?你找到解决办法了吗?我也有同样的问题。@papaiatis,不幸的是没有。在我运行安装和配置Python的工作之后,我必须重新启动Jenkins从机。