Parcel.NExT.Python.zh

Parcel.NExT.Python.Helpers.ZoraPythonRuntimeStandardDistributionConstants

包含用于 Zora Python 运行时的标准分发常量。

Parcel.NExT.Python.Helpers.ZoraPythonRuntimeStandardDistributionConstants.CurrentZoraPythonDistributionVersion

获取当前的 Zora Python 分发版本。

Parcel.NExT.Python.Helpers.ZoraPythonRuntimeStandardDistributionConstants.MinNumpyVersion

获取所需的最低 Numpy 版本。

Parcel.NExT.Python.Helpers.ZoraPythonRuntimeStandardDistributionConstants.MinPandasVersion

获取所需的最低 Pandas 版本。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper

提供用于与 Python 运行时交互和管理的辅助方法。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonDistributionMode

指示我们正在使用的 Python 分发模式。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonDistributionMode.System

我们正在使用随 Zora 捆绑的 Python。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonDistributionMode.User

我们正在使用用户指定重写的 Python。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonDistributionMode.Local

我们正在使用本地计算机上存在的 Python。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonDistributionMode.None

没有可用的 Python 安装。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonExecutableName

Python 可执行文件的名称。

Remarks

设为私有,因为一般情况下我们不希望 Zora 包明确查找 Python 分发,我们将提供一个用于与系统或嵌入式 Python 交互的接口层。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PipExecutableName

Pip 可执行文件的名称。

Remarks

设为私有,因为通常我们不希望 Zora 包显式查找 Python 分发版;我们会提供一个接口层来与系统安装或嵌入式 Python 进行交互。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.ZoraCustomPythonDistributionEnvironmentVariableName

用于自定义 Python 分发路径的环境变量名称。

Remarks

用于指定 python.exe、pip.exe 及运行时脚本依赖项的自定义路径。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.GetZoraDefaultDistributionPythonFolders

获取随 Zora 附带的 Python 分发版的默认位置。该值可以被 所覆盖。

Returns

一个包含文件夹路径的数组。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.CustomPythonDistributionPaths

从环境变量中获取自定义 Python 分发路径。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.HasPython

获取一个值,用以指示当前(Zora)分发版是否具有可用的 Python。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.WhichPython()

确定正在使用的 Python 分发版,并检索其路径及版本信息。

Parameters

NameDescriptionDefault
path 当此方法返回时,如果找到,则包含 Python 可执行文件的路径;否则为 null
version 当此方法返回时,如果找到,则包含 Python 版本;否则为 null

Returns

返回一个 Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonDistributionMode 枚举值,指示找到的 Python 分发类型。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.WhichPython()

确定正在使用的 Python 分发版,并检索其路径。

Parameters

NameDescriptionDefault
path 当此方法返回时,如果找到,则包含 Python 可执行文件的路径;否则为 null

Returns

返回一个 Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonDistributionMode 枚举值,指示找到的 Python 分发类型。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.GetModuleVersion()

获取指定Python模块的已安装版本。

Remarks

设置为内部使用,因为通常我们不希望Zora包显式查找Python发行版,我们会提供一个接口层以连接系统内置或嵌入式的Python。

Parameters

NameDescriptionDefault
module Python模块的名称。

Returns

如果可用,则返回模块版本字符串;否则返回null

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.GetPythonVersion

获取已安装的Python版本。

Remarks

设置为内部使用,因为通常我们不希望Zora包显式查找Python发行版,我们会提供一个接口层以连接系统内置或嵌入式的Python。

Returns

如果可用,则返回Python版本字符串;否则返回null

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.GetPythonVersion()

获取指定Python程序路径的Python版本。

Parameters

NameDescriptionDefault
programPath Python可执行文件的路径。

Returns

如果可用,则返回Python版本字符串;否则返回null

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PythonEngineAlreadyInitialized

获取一个值,指示Python引擎是否已初始化。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.TryInitializeEngine

如果尚未初始化,则尝试初始化Python引擎。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.InitializeEngine

初始化Python引擎。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.PerformCustomEnvironmentInitialization()

使用指定的路径为Python引擎执行自定义环境初始化。

Parameters

NameDescriptionDefault
paths 要包含在Python环境中的路径数组。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.TryShutdownEngine

尝试关闭Python引擎。

Remarks

通常应由运行时调用此函数(否则通常在前端实现),否则整个应用程序将无法正确关闭。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.DependencyRequirement

表示Python运行时的依赖项要求。

Parameters

NameDescriptionDefault
Name 依赖项的名称。
MinVersionPrefix 所需的最小版本前缀。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.DependencyRequirement.#ctor()

表示Python运行时的依赖项要求。

Parameters

NameDescriptionDefault
Name 依赖项的名称。
MinVersionPrefix 所需的最小版本前缀。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.DependencyRequirement.Name

依赖项的名称。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.DependencyRequirement.MinVersionPrefix

所需的最小版本前缀。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.ValidateDependencies()

验证当前Python环境是否满足指定的版本和依赖项要求。

Parameters

NameDescriptionDefault
validPythonVersions 可选的有效Python版本前缀数组。如果未提供,则使用当前的Zora发行版版本。
dependencyRequirements 可选的依赖项要求数组。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.RunScopedSnippetAsFunctionBody()

在新的 Python 作用域中,将指定的代码片段作为函数体运行,并返回其结果。

Remarks

需要显式 return 语句;不支持 import 操作,否则可能导致语法错误或意外行为。

Parameters

NameDescriptionDefault
snippet 要运行的 Python 代码片段。

Returns

一个 Python.Runtime.PyObject 表示执行函数的结果。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.RunTopLevelSnippet()

以执行脚本文件的方式运行代码片段,使用 Python 可执行程序。

Parameters

NameDescriptionDefault
snippet 要执行的 Python 代码片段。
shutDown 一个值,指示执行后是否关闭 Python 引擎。默认值为 true

Returns

一个 Python.Runtime.PyModule 表示 Python 执行作用域。

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.GetDistributionPythonDllPath

获取当前发行版的活动 Python DLL 路径。

Returns

如果找到,则返回 Python DLL 的路径;否则返回 null

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.GetDistributionPythonProgramPath

获取当前发行版的活动 Python 程序路径。

Returns

如果找到,则返回 Python 可执行文件的路径;否则返回 null

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.GetDistributionPipPath

获取当前发行版的活动 Pip 程序路径。

Returns

如果找到,则返回 Pip 可执行文件的路径;否则返回 null

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.FindPythonDLL()

在指定的路径中搜索 Python DLL。

Parameters

NameDescriptionDefault
paths 要搜索的路径数组。

Returns

如果找到,则返回 Python DLL 的路径;否则返回 null

Parcel.NExT.Python.Helpers.PythonRuntimeHelper.FindPythonPip

在环境路径中搜索 Pip 可执行文件。

Returns

如果找到,则返回 Pip 可执行文件的路径;否则返回 null

Parcel.NExT.Python.PythonReflection

提供与 Python 相关的反射功能。