表示由 StartExternalSession 启动的与 ExternalEvaluate 一起使用的外部会话.
ExternalSessionObject
外部运算器列表 »表示由 StartExternalSession 启动的与 ExternalEvaluate 一起使用的外部会话.
更多信息
- ExternalSessionObject[…][prop] 返回外部会话的属性.
- 可以使用以下属性:
-
"System" 要启动的外部系统或语言 "Version" 要使用的外部系统的版本(如 "3.6") "Kernel" Jupyter 内核名称(如 "IFSharp") "Target" 用来执行代码的目标 "ReturnType" 返回对象的类型 ("String"、"Expression"、...) "Prolog" 在命令之前运行的代码 "Epilog" 在命令之后运行的代码 "SessionProlog" 在会话之前运行的代码 "SessionEpilog" 在会话之后运行的代码 - 可用 ExternalSessionObject[…]["Properties"] 查询可用属性.
- DeleteObject[ExternalSessionObject[…]] 删除外部会话对象.
范例
打开所有单元 关闭所有单元基本范例 (2)
启动外部会话,获取一个 ExternalSessionObject:
session = StartExternalSession["Python"]用 DeleteObject 删除外部会话:
DeleteObject[session]查询 ExternalSessionObject 的属性:
session = StartExternalSession["NodeJS"]session["Executable"]DeleteObject[session]范围 (2)
session = StartExternalSession["Python"]session["Properties"]生成 ExternalSessionObject 所有属性的数据集:
Dataset @ session[All]DeleteObject[session]在会话中运行代码,并看到 "EvaluationCount" 属性值增大:
session = StartExternalSession["Python"];
Dynamic[session["EvaluationCount"]]Do[ExternalEvaluate[session, "2+2"], 10]Dynamic[Quantity[session["SessionTime"], "Seconds"]]属性和关系 (2)
用 ExternalSessions 获取所有外部会话:
StartExternalSession["NodeJS"];
StartExternalSession["Python"];
ExternalSessions[]DeleteObject[%]获取用于启动会话的 ExternalEvaluatorObject:
session = StartExternalSession["Python"]session["EvaluatorObject"]DeleteObject[session]相关指南
-
▪
- 外部语言接口 ▪
- 外部已诠释的语言接口
相关的工作流程
文本
Wolfram Research (2017),ExternalSessionObject,Wolfram 语言函数,https://reference.wolfram.com/language/ref/ExternalSessionObject.html.
CMS
Wolfram 语言. 2017. "ExternalSessionObject." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/ExternalSessionObject.html.
APA
Wolfram 语言. (2017). ExternalSessionObject. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/ExternalSessionObject.html 年
BibTeX
@misc{reference.wolfram_2026_externalsessionobject, author="Wolfram Research", title="{ExternalSessionObject}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/ExternalSessionObject.html}", note=[Accessed: 10-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_externalsessionobject, organization={Wolfram Research}, title={ExternalSessionObject}, year={2017}, url={https://reference.wolfram.com/language/ref/ExternalSessionObject.html}, note=[Accessed: 10-September-2026]}