将Jupyter与Windows子系统用于Linux

Gra*_*ale 5 python jupyter-notebook windows-subsystem-for-linux

在Windows 10上使用Ubuntu bash终端(这里的安装说明),我安装了Anaconda,并且一直使用Jupyter笔记本电脑没有问题.不幸的是,Jupyter无法从子系统中找到可运行的浏览器,因此我必须复制并粘贴它在终端中输出的链接 - 但这是可行的.当我尝试打开多个笔记本时,主要问题就出现了.通常,Jupyter会检测到一个端口(8888默认情况下)已经被使用并创建一个新端口,但它似乎无法检测到这一点,因此当我使用它生成的链接时,我最终看到我打开的第一个笔记本而不是新的.

知道问题可能是什么吗?如果没有,我怎么能手动解决这个问题呢?

小智 15

尝试:

jupyter notebook --no-browser
Run Code Online (Sandbox Code Playgroud)


Q. *_*iao 8

启动笔记本时手动分配不同的端口号。例如:

jupyter notebook --port=8889


Nic*_* G. 6

我遇到了 Jupyter 找不到文件的问题(完整的德语错误消息):

Start : Dieser Befehl kann aufgrund des folgenden Fehlers nicht ausgeführt werden: Das System kann die angegebene
Datei nicht finden.
In Zeile:1 Zeichen:1
+ Start "file:///home/nico/.local/share/jupyter/runtime/nbserver-1164-o ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Run Code Online (Sandbox Code Playgroud)

Jupyter 确实有效,但当我输入jupyter notebook.

我找到了一个非常简单的解决方案:

  1. 创建 Jupyter 配置文件:
touch $HOME/.jupyter/jupyter_notebook_config.py
Run Code Online (Sandbox Code Playgroud)
  1. 现在添加以下行(通过使用nano或任何其他文本编辑器):
c.NotebookApp.use_redirect_file = False
Run Code Online (Sandbox Code Playgroud)

现在我的 WSL2 使用该wslview命令在 Windows 中打开默认浏览器。(我认为)

如果wslview .什么都不做,您可能需要手动安装wslu