在Windows 10中将JupyterLab作为桌面应用程序运行

问题描述:

Cristopher Roach撰写了博客"将Jupyter Lab作为桌面应用程序运行"对于Mac用户.对于Windows 10中的Anaconda用户而言,它不起作用.最终,我的工作如下:

Cristopher Roach wrote the blog of "Running Jupyter Lab as a Desktop Application" for Mac users. It did not work for Anaconda users in Windows 10. Eventually, what I did is the below:

  1. 转到C:\ ProgramData \ Anaconda3 \ Scripts的目录
  2. 找到jupyter-lab.exe的文件,然后在任务栏中创建文件的链接.注意:由于某些原因,当我尝试在桌面上建立链接时,会弹出寡妇无法创建快捷方式.请检查磁盘是否已满"的消息.
  3. 右键单击jupyter-lab.exe链接,然后转到属性".
  4. 下载Jupyterlab的图标文件,并将其另存为C:\ ProgramData \ Anaconda3 \ Menu \ Jupyterlab.ico(=`%ALLUSERSPROFILE%\ Anaconda3 \ Menu \ Jupyterlab.ico)文件夹中的Jupyterlab.ico
  5. >
  6. 单击更改图标",然后在在此文件中查找图标"中复制%ALLUSERSPROFILE%\ Anaconda3 \ Menu \ Jupyterlab.ico.
  7. 完成!

需要经历许多步骤.有没有更简单的方法?

Many steps were required to go through. Is there any simpler way?

1.将Jupyter Lab设置为作为Chrome应用运行

从开始"菜单运行Anaconda Prompt,然后输入:

1. Set Jupyter Lab to run as a Chrome App

Run Anaconda Prompt from your Start menu and type:

jupyter lab --generate-config

使用您喜欢的文本编辑器打开在以下位置找到的Jupyter配置文件:

Use your favorite text editor to open the Jupyter config file found on this location:

C:\Users\<User>\.jupyter\jupyter_notebook_config.py

将此行添加到配置文件的末尾:

Add this line to the end of the config file:

c.NotebookApp.browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe --app=%s"

2.创建运行Jupyter Lab的快捷方式

导航到

"C:\Users\Serendipity\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)"

复制 Jupyter Notebook 快捷方式并将其命名为 Jupyter Lab
右键单击新创建的Jupyter Lab快捷方式,然后转到属性",将图标更改为已下载的图标,将注释字段更改为"Jupyter Lab".在目标"字段上,将其显示为jupyter-notebook-script.py,将其更改为jupyter-lab-script.py.

Make a copy of the Jupyter Notebook shortcut and name it Jupyter Lab
Right click the newly created Jupyter Lab shortcut and go to Properties, change the icon to your downloaded icon, change the comment field to say "Jupyter Lab". On the Target field, where it says jupyter-notebook-script.py, change it to jupyter-lab-script.py.

目标"字段应如下所示:

The Target field should look like this:

C:\Users\Serendipity\Anaconda3\python.exe C:\Users\Serendipity\Anaconda3\cwp.py C:\Users\Serendipity\Anaconda3 C:\Users\Serendipity\Anaconda3\python.exe C:\Users\Serendipity\Anaconda3\Scripts\jupyter-lab-script.py %USERPROFILE%

运行快捷方式,它应该会生成一个命令提示符,以运行服务器实例以及Jupyter Lab Chrome App窗口.

Run the shortcut, it should spawn a command prompt running the server instance, and the Jupyter Lab Chrome App window.

您可以创建一个快捷方式,以使用右键单击->新建>快捷方式并将其用作定位目标来连接到本地服务器:

You can create a shortcut to connect to a local server with Right Click->New>Shortcut and using this as location target:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app=http://localhost:8888/

您还可以通过在Anaconda Prompt控制台中键入jupyter lab --no-browser来启动服务器而无需生成Chrome应用程序窗口.

You can also start a server without spawning the Chrome App window by typing jupyter lab --no-browser into the Anaconda Prompt console.