python - 适用于 Linux (WSL 2) 和 Jupyter Lab 的 Windows 子系统 : How to open a Jupyter Notebook saved at the Linux file system?

标签 python jupyter-notebook filesystems windows-subsystem-for-linux jupyter-lab

我在 Windows 上安装了一个 Jupyter 实验室。我在 WSL Ubuntu 上安装了 Jupyter Lab。我可以在 Linux 终端上用 Jupyter Lab 午餐。这将在 Chrome 浏览器上打开 Jupyter Lab,从中我可以使用 Python [conda env:root]* 启动一个新的 Jupyter Notebook。但是,它只显示 Windows 文件系统。我尝试使用以下命令打开保存在 Linux 文件系统上的笔记本:$ jupyter lab my_linux_folder/my_notebook.ipynb
Jupyter 实验室午餐成功,但无法打开 Linux 文件系统上的 notebook 并给出错误:

Cannot open
Could not find path: /my_notebook.ipynb



是否可以打开位于 Linux 文件系统“\wsl$\”上的笔记本以及如何打开?
如何从 JupyterLab 文件浏览器转到“\wsl$\”?
或者更一般地说,如何打开保存在 "\wsl$\"下的笔记本?

最佳答案

每次启动 WSL 2 时,WSL 2 都会发出一个动态 IP 地址 -- see MSFT docs .
就个人而言,我在子 shell 中运行 Python 命令来打印该 IP:

jupyter lab --ip $(python3 -c "import subprocess; subprocess.run(['hostname', '-I'], text=True).stdout")
这在 Ubuntu 20.04 和 Windows 10 build 19041.329 上对我有用。

Note: You'll likely have to visit that IP address instead of localhost, plus the port through which you're running Jupyter, e.g. http://:8888 .


要通过 CLI 获取我的 IP 地址,我使用:
ip addr | grep eth0 | grep inet
我选择第一个可用的 IP 地址,通常使用不带子网掩码的地址,即正斜杠 + 数字。

关于python - 适用于 Linux (WSL 2) 和 Jupyter Lab 的 Windows 子系统 : How to open a Jupyter Notebook saved at the Linux file system?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62353890/

相关文章:

jupyter-notebook - ipython 笔记本将表格与单元格左侧对齐

windows - 如何在 CreateFile 中打开卷的文件系统?

python - rdflib "repeat node-elements"OWL/XML 文件解析错误

python - 未处理的异常 : Connection closed while receiving data

python - 无法在终端 : "execution_count": null 中执行 jupyter notebook

linux - ipython 在启动时给出属性错误

python - Android Market API - Python ImportError : No module named google. protobuf

python - 嵌套的 Django 标签

r - Rscript.exe 中包含 Unicode 字符的文件路径

Java - 确定磁盘格式(RAW 或 FS)