简体   繁体   English

Rundeck - 我为运行 python 脚本而创建的作业调用了不同的 python

[英]Rundeck - The job that I created to run python scripts calls a different python

I'm quite new in using Rundeck.我对使用 Rundeck 还很陌生。 I have job that should be executing a python file.我有应该执行 python 文件的工作。 Just to give you an overview my device has python 3.8.5 and 3.7.只是给你一个概述我的设备有 python 3.8.5 和 3.7。 Rundeck uses the version 3.7 even though in my environment variable I set my PY_HOME for version 3.8.5. Rundeck 使用 3.7 版,即使在我的环境变量中我将 PY_HOME 设置为 3.8.5 版。 How can I tell my rundeck to use version 3.8.5?如何告诉我的 rundeck 使用 3.8.5 版? Appreciate the help.感谢帮助。

You can define any interpreter for your scripts (python2, python3, etc) on your scrip steps, just go to your job, on the "Script" step (inline script) or "Script File or URL" step click on the "Advanced" button and add the path of your Python 3.8.5 on "Invocation String" textbox and the ".py" on "Extension" textbox, take a look at this .您可以在脚本步骤中为您的脚本(python2、python3 等)定义任何解释器,只需转到您的工作,在“脚本”步骤(内联脚本)或“脚本文件或 URL”步骤中单击“高级”按钮并在“调用字符串”文本框上添加 Python 3.8.5 的路径,在“扩展”文本框上添加“.py”,看看这个.

I leave a job definition example with this:我留下了一个工作定义示例:

<joblist>
  <job>
    <defaultTab>nodes</defaultTab>
    <description></description>
    <executionEnabled>true</executionEnabled>
    <id>031b03b4-220f-4ad0-9c47-3ca47506ba82</id>
    <loglevel>INFO</loglevel>
    <name>HelloWorldPy</name>
    <nodeFilterEditable>false</nodeFilterEditable>
    <plugins />
    <scheduleEnabled>true</scheduleEnabled>
    <sequence keepgoing='false' strategy='node-first'>
      <command>
        <fileExtension>.py</fileExtension>
        <script><![CDATA[print("hello world!")]]></script>
        <scriptargs />
        <scriptinterpreter>C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe</scriptinterpreter>
      </command>
    </sequence>
    <uuid>031b03b4-220f-4ad0-9c47-3ca47506ba82</uuid>
  </job>
</joblist>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM