使用 VSCode 连接到 Jupyter 实例

r0f*_*0f1 6 python jupyter visual-studio-code google-dl-platform

我有一个正在运行的 Google 深度学习 VM,我设置了一个 SSH 隧道,当我导航到http://localhost:8080时,我连接到正在运行的 Jupyter Lab 实例。运行命令sudo service jupyter status,告诉我服务运行正常。

现在,我想使用 Visual Studio Code 连接到 Jupyter 实例。我尝试了 [Ctrl]+[Shift]+[P] 和“Python:指定 Jupyter 服务器 URI”,并在出现的提示中输入http://localhost:8080 。但是,我收到一条错误消息:

Failed to connect to remote Jupyter notebook.
Check that the Jupyter Server URI setting has a valid running server specified.
http://localhost:8080/
Error: Failed to connect to password protected server. Check that password is correct.
Run Code Online (Sandbox Code Playgroud)

不幸的是,文档并没有说太多

有人有将 VSCode 连接到远程服务器的经验吗?谢谢。

r0f*_*0f1 4

显然,你必须设置一个密码。我按照此处的说明创建了哈希密码。然后我编辑了我的jupyter_notebook_config.py文件并编辑了该行c.NotebookApp.password = '<my_super_secret_hash>'。最终,我可以连接 VSCode。