[英]Jupyter Notebooks in VS Code using WSL 2 are not working
I want to use Jupyter Notebooks inside VS Code running within WSL 2. Regular Python works within WSL without a problem, that means the base conda enviroment is connected and I can run .py files.我想在 WSL 2 中运行的 VS Code 中使用 Jupyter Notebooks。常规 Python 在 WSL 中运行没有问题,这意味着基本 conda 环境已连接,我可以运行 .py 文件。 Moreover, I'm able to run the command
jupyter notebook
which will start the notebook server within WSL exposing the localhost to the Windows system.此外,我能够运行命令
jupyter notebook
,它将在 WSL 中启动笔记本服务器,将本地主机暴露给 Windows 系统。
However, I want to test the new Jupyter Notebook feature within VS Code, which is not working for me;但是,我想在 VS Code 中测试新的 Jupyter Notebook 功能,这对我不起作用; VS Code shows:
Jupyter Server: No Kernel
and Python: Not Started
(see screenshot below). VS Code 显示:
Jupyter Server: No Kernel
和Python: Not Started
(请参见下面的屏幕截图)。
My testing machine is:我的测试机是:
What I did:我做了什么:
code .
)code .
)中打开 VS CodePython: Create New Blank Jupyter Notebook
Python: Create New Blank Jupyter Notebook
创建一个新的 Notebook 文件Python: Create New Blank Jupyter Notebook
print("test")
print("test")
Is there anything I'm missing?有什么我想念的吗?
The VS Code insiders actually works out of box with Jupyter notebooks. VS Code 内部人员实际上与 Jupyter 笔记本一起开箱即用。 Just remember to run
code-insiders .
请记住运行
code-insiders .
instead of code .
而不是
code .
. .
Another solution would be, according to this website , start the VS Code in windows, then use WSL 2 as a remote server.另一种解决方案是,根据这个网站,在 Windows 中启动 VS Code,然后使用 WSL 2 作为远程服务器。
The code installation on wsl2 needs a restart to work properly, I was told by a notification, and in the question's comments you may see people experiencing the same issue(' it's working now. not sure why'). wsl2 上的代码安装需要重新启动才能正常工作,通知告诉我,在问题的评论中,您可能会看到人们遇到同样的问题(“现在正在工作。不知道为什么”)。 So before looking upon any elaborate solution, just restart code.
因此,在查看任何精心设计的解决方案之前,只需重新启动代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.