如何通过网络在 JupyterLab 运行 中访问文件,这给我带来了很多错误?

How can I get file access in JupyterLab running over the web, which is giving me many errors?

更新:我从与其他人的讨论中得出结论,这是一个真正的错误; JupyterLab 的网络版本目前不允许您访问文件。

当我在网络上 运行 JupyterLab 时,例如来自 Jupyter。org/try,我在文件方面遇到了一些困难。我认为某些东西已损坏——我怎样才能获得正常的 JupyterLab 环境?以下是一些问题:

1) 我无法从我的机器访问文件。 命令 os.chdir("C:") 给出错误

FileNotFoundError: [Errno 44] No such file or directory: 'C:'

2) 我无法从 Web 访问文件。 首先命令 import pandas as pd 给出错误

Could not import the lzma module. Your installed Python is incomplete

然后命令pd.read_csv("https://data.nasa.gov/api/views/7qz6-zrqt/rows.csv") (它读取一个易于访问的 csv 文件)给出了错误

URLError: <urlopen error unknown url type: https>

3) 我无法访问我上传到屏幕左侧可见文件夹中的文件。 命令 pwd returns '/home/pyodide' 但是无论从那个目录移动多少似乎都无法将我带到一个包含我上传的文件或我创建的笔记本的目录。

4) 我无法删除屏幕左侧文件夹中可见的一些文件。 例如:我不记得上传或修改过文件“Lorenz.ipynb”。我尝试删除它,并在此屏幕上按“删除”,但文件仍然存在。

我还在我的机器上直接安装了 JupyterLab,运行 没有这些问题——但我试图说服人们通过网络使用 JupyterLab 是进入 Python,这些错误阻止了这种情况。如何让 JupyterLab 在网络上正常工作?

抱歉,我(和其他人)之前没有看到您的问题。我将主要向您推荐最近讨论类似事情的地方,因为这是一个发展非常迅速的利基市场。
简短的回答是,我建议不要鼓励那些刚刚进入 Python 的人使用 JupyterLite,这就是你所说的,“当我 运行 JupyterLab 在网络上时,例如来自Jupyter.org/try,[此时]。您会注意到,在 JupyterLite site itself 处,它的状态表示为“实验性”、“cutting-edge”、“非官方”等

How can I get JupyterLab working normally over the web?

前往 here and click launch binder. This will give you a temporary session that will time out after ten minutes inactivity on a remote linux-based machine. The Jupyter in use there is full Python-backed. You can upload files by dragging them in the file navigator and you can download new or modified files from the remote machine back to your system. I go more into using it here。请务必注意,即使会话超时,笔记本电脑也有安全网。

此时,您将获得更好的体验,将人们引导至 MyBinder-served 具有完整 Python 内核的站点,这些站点位于实际的远程计算机上,以满足您“让人们相信 JupyterLab by web 是一个进入 Python".

的简单方法

如果您想继续使用 JupyterLite,请在以下位置查看关于您遇到的一些(以及更多)问题的注意事项: