第三方库支持

Version 25.2.9333


Version 25.2.9333

第三方库支持


You can use third-party libraries when writing Python in 知行之桥. In the Jep Java API, you can choose between two types of Python interpreters:

  • SharedInterpreter
  • SubInterpreter

Keep the following in mind when you configure your environment to use Python.

Use SharedInterpreter if:

  • You are new to running Python scripts in .
  • You are using third-party libraries like NumPy.

Use SubInterpreter if:

  • You require parallel script execution.
  • Full third-party library support is not important to you.

This behavior is controlled by the SHARED_INTERPRETER environment variable. If you set the environment variable SHARED_INTERPRETER=false, uses SubInterpreter.

If you do not set the environment variable, or you explicitly set it to true, defaults to SharedInterpreter.

Note: While restricts access to modules based on the value of ScriptingEngineHardeningLevel, it cannot fully guarantee that third-party libraries installed on the system abide by these rules. Use this with caution in highly controlled environments.

在知行之桥中编写 Python 代码时,可以使用第三方库。在 Jep Java API 中,可以选择两种类型的 Python 解释器:

  • 共享解释器(SharedInterpreter)
  • 子解释器(SubInterpreter)

配置知行之桥环境以使用 Python 时,请注意以下几点。

在以下情况下,请使用 共享解释器(SharedInterpreter)

  • 第一次在知行之桥中运行 Python 脚本。
  • 正在使用 NumPy 等第三方库。

在以下情况下,请使用 子解释器(SubInterpreter)

  • 需要并行执行脚本。
  • 是否完全支持第三方库对您来说并不重要。

此行为由 SHARED_INTERPRETER 环境变量控制。如果设置环境变量 SHARED_INTERPRETER=false,知行之桥将使用 子解释器(SubInterpreter)

如果未设置环境变量,或将其明确设置为true,则知行之桥默认为共享解释器(SharedInterpreter)

注意:虽然知行之桥会根据 ScriptingEngineHardeningLevel 的值限制对模块的访问,但它无法完全保证系统上安装的第三方库遵守这些规则。在严格控制的环境中请谨慎使用。