一、前言
VSCode中最新版的Microsoft Python插件其实已经包含了以前jupyter插件的功能,所以只要安装了Python插件(就是下面这个),理论上是可以打开、编辑、运行 .ipybn类型的文件的。
然而实际上当我尝试运行ipynb文件的时候,由于VSCode没有办法找到Jupyter Server,会显示如下错误:
Error: Activating Python 3.7.0 64-bit ('mxnet': venv) to run Jupyter failed with Error: StdErr from ShellExec
这时就算你在终端启动了jupyter notebook,VSCode仍然显示Jupyter Server Not Started | No Kernel 。
二、解决办法
(要确保已经安装jupyter notebook, pip install jupyter或者conda install jupyter)
1.在VSCode 的setting.json文件中加入:"python.terminal.activateEnvironment": false
2.然后重启VSCode,就会自动开启本地的Jupyter Server,然后你可以按下f1,选择 Python:select interpreter to start jupyter server,选择不同的python编译器。
成功开启后:
三、参考资料
https://github.com/microsoft/vscode-python/issues/4013
如果文章对你有帮助的话,可以点个赞再走哦!