在vscdoe中使用Mathematica
在vscode 官网下载 vscode
安装 Mathematica
建议Mathematica 的版本大于12.1。因为vscode的 wolfram Language lsp 插件 Wolfram Language Server 的相关包(特别是LSPServer.paclet)要求wolfram版本为12.1+
在vscode 安装 Wolfram 相关扩展
安装 Wolfram Language(shigma)
这个扩展主要是用于实现语法高亮
- 安装扩展
- 根据提示进行配置 Wolfram Language 扩展
安装 Wolfram Language Server(lsp-wl)
这个扩展主要是用于实现内置函数自动补全、悬浮帮助文档以及调试
- 安装扩展
- 下载 wl-lsp
- 根据提示进行配置 Wolfram Language Server 扩展
- 在vscode 的 设置 json 中使用如下配置,对信息进行过滤:
{
"WolframLanguageServer.Diagnostics.mitigated": [
"ExperimentalSymbol",
"UnusedParameter",
"UnusedVariable",
],
"WolframLanguageServer.Diagnostics.suppressed": [
"DifferentLine",
"SuspiciousSessionSymbol",
"NonASCIICharacter",
]
}在 vscode 的 jupyter 中使用Mathematica
安装 Miniconda
安装jupyter包
小贴士
建议在新环境中安装,不要安装在base环境中
创建新环境
conda create -n -NewEnve安装jupyter包
conda activate NewEnve
conda install jupyter在vscode 安装python插件
在Mathematica 中 安装 jupyter包
在Mathematica中执行下方命令
(*安装扩展包*)
PacletInstall["WolframLanguageForJupyter-0.9.3.paclet"]
(*加载扩展包*)
Needs["WolframLanguageForJupyter`"]
(*配置扩展包*)
ConfigureJupyter["Add", "JupyterInstallation" -> "安装了jupyter包的python环境目录\\Scripts\\jupyter.exe"]
(*例如:
ConfigureJupyter["Add", "JupyterInstallation" -> "E:\\0-AppData\\CondaEnvs\\SciCalc\\Scripts\\jupyter.exe"]*)- 在vscode 中创建一个 jupyter notebook 文件(后缀为 .ipynb),点击右上方内核选择,选择wolfram 内核
- 愉快地在Jupyter中使用Mathematica!
最后更新于 • Tlong