我试着按照Jupyter笔记本文档上的说明去做。

不幸的是,我还没弄明白。这个“开始”的领域到底在哪里?

我有一个windows 7(64位)系统,安装了Anaconda3(不在C驱动器中)。我想改变Jupyter开始文件夹的位置。


当前回答

我用的是Windows 10,不过是同一个版本的Anaconda。

Click on the Start Menu, then All Programs (just Programs for Win10) Click on the Anaconda3 folder; mine is Anaconda3 (64-bit) In there you should see Jupyter Notebook. If you have a virtual environment installed, it will be followed by the environment name like this: Jupyter Notebook (env) Right-click Jupyter Notebook entry and navigate to More => Open File Location Right-click the correct Jupyter Notebook entry, then click on Properties Enter a path in the Start in: box; if the path has spaces in it, you must enclose it in double quotes Delete "%USERPROFILE%" at the end of the executable path

其他回答

钻石笔记本和钻石实验室(且说

对于旧的Jupyter Notebook接口,安装在Notebook包中并作为Jupyter Notebook运行(请参阅下一节,以nbclassic安装并以Jupyter nbclassic运行,以及用于JupyterLab):

Open cmd (or Anaconda Prompt) and run jupyter notebook --generate-config. This writes a file to C:\Users\username\.jupyter\jupyter_notebook_config.py. Browse to the file location and open it in an Editor Search for the following line in the file: #c.NotebookApp.notebook_dir = '' Replace by c.NotebookApp.notebook_dir = '/the/path/to/home/folder/' Make sure you use forward slashes in your path and use /home/user/ instead of ~/ for your home directory, backslashes could be used if placed in double quotes even if folder name contains spaces as such : "D:\yourUserName\Any Folder\More Folders\" Remove the # at the beginning of the line to allow the line to execute

朱比特经典笔记本>= 3

最近nbclassic和JupyterLab >= 3使用c.ServerApp。root_dir而不是c.NotebookApp。Notebook_dir(和jupyter server—generate-config而不是jupyter notebook—generate-config)。

有关上下文,请参阅迁移指南和关于服务器和笔记本之间差异的问题。

对于Windows用户,这里有一个片段,让你右键单击文件夹并打开Jupyter实验室。

def add_jupyter_to_context_menu(self):
    import winreg

    key = winreg.HKEY_CURRENT_USER
    command_value = rf'cmd.exe /k jupyter lab --notebook-dir="%V"'

    handle = winreg.CreateKeyEx(key, "Software\Classes\directory\Background\shell\Open with JupyterLab\command", 0,
                                winreg.KEY_SET_VALUE)
    winreg.SetValueEx(handle, "", 0, winreg.REG_SZ, command_value)

    # You need to download the icon yourself, or leave this part out for no icon
    icon_value = fr"C:\some_folder\jupyter_icon.ico"
    handle = winreg.CreateKeyEx(key, "Software\Classes\directory\Background\shell\Open with JupyterLab", 0,
                                winreg.KEY_SET_VALUE)
    winreg.SetValueEx(handle, "icon", 0, winreg.REG_SZ, icon_value)

def remove_jupyter_from_context_menu(self):
    import winreg
    key = winreg.HKEY_CURRENT_USER
    winreg.DeleteKey(key, "Software\Classes\directory\Background\shell\Open with JupyterLab\command")
    winreg.DeleteKey(key, "Software\Classes\directory\Background\shell\Open with JupyterLab")

以防有人还在寻找答案/其他选择。这是最适合我的。

创建一个.bat文件。 在.bat文件中。将C:\Users\usr\folders\更改为jupyter notebook默认打开的文件夹。 cd C:\Users\usr\folders jupyter笔记本 保存.bat文件并将其放置在任何您想要的位置。通常我会为我正在做的每个项目创建.bat文件。把这些.bat文件看作是快捷方式。 双击。bat文件启动jupyter笔记本在预定的路径。

这是我为Windows 10 Anaconda Navigator找到的解决方案。

步骤1:搜索Jupyter Notebook并导航到文件位置。大致如下

步骤2:右键单击Jupyter Notebook,选择属性。将您的目录添加到Target。我的是D:\教育\机器学习

步骤3:不要从Anaconda Navigator中启动Jupyter Notebook。请使用上面的快捷方式。

下面是我遇到的同样问题是如何解决的。我为解决这些问题所采取的大部分步骤已经在其他人之前提供的解决方案中描述过了。

有两种方式启动Jupyter笔记本应用程序

来自水蟒航海家 使用快捷方式(名称:Jupyter Notebook)到Jupyter Notebook应用程序。在Windows操作系统中,通常可以在以下文件夹中找到: C:\Users\ AppData\漫游\Microsoft\Windows\开始菜单\程序\Anaconda3(64位)

有不同的方式配置Jupyter笔记本应用程序,以保存笔记本在一个文件夹,而不是默认的。

如果使用蟒蛇导航器发射笔记本电脑

在使用Anaconda导航器来启动Jupyter笔记本应用程序的情况下,配置的方法是取消注释“c.NotebookApp”。“jupyter_notebook_config.py”中的“Notebook_dir”字段,并添加路径。更新后的字段看起来像: c.NotebookApp。notebook_dir = <此处输入绝对路径>

在Windows的情况下,当Anaconda为特定用户安装时,该文件位于C:\Users\<USERNAME>.jupyter。

如果你找不到”。“Jupyter”文件夹,然后执行以下步骤来创建它

运行anaconda命令提示符 在命令提示符下运行"jupyter notebook——generate-config"

如果使用快捷方式(名称:Jupyter Notebook)来启动Jupyter Notebook应用程序

如果你检查这个快捷方式的目标框中的命令,你会注意到Notebook应用程序是通过执行文件“C:\Users\<USERNAME>\Anaconda3\Scripts\ jupyter-notebook-script.py”来启动的,该文件接受一个路径参数。

定义笔记本文件保存位置的基本方法是——>,用于在启动Jupyter notebook应用程序时提供所需文件夹的路径。这可以通过两种方式实现:

创建一个指向所需文件夹的环境变量,并将其用作参数 在快捷方式本身中定义绝对路径

遵循以下步骤:(注意:用实际文本替换尖括号中的文本)

Locate the shortcut "Jupyter Notebook". When Anaconda was installed for a particular user (during installation the choice selected was for the user only) the shortcut (Name: "Jupyter Notebook", Type: Shortcut) resided in "C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)" Right click on the shortcut and select "Properties" In the "Target" box locate C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py %USERPROFILE% Replace "%USERPROFILE%" with a. Either: the environment variable created to point to the folder where you want to store the notebook files. The command will look like: C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py %<ENVIRONMENTVARIABLE>% b. OR: the absolute path to the work folder you want the notebook files to be stored in. The command will look like: C:\Users\<USERNAME>\Anaconda3\Scripts\jupyter-notebook-script.py <F://folder//subfolder> Replace the text (path) in "Start In" box with: a. Either: the environment variable created to point to the folder where you want to store the notebook files. The text in "Start In" box will look like: %<ENVIRONMENTVARIABLE>% b. OR: the absolute path to the work folder you want the notebook files to be stored in. The text in "Start In" box will look like: <F://folder//subfolder>

注意1:如果路径中有空格,那么整个路径应该用双引号括起来。

注2:此解决方案中的路径适用于为特定用户(而不是所有用户)在Windows上安装Anaconda 3(和Jupyter 3)的情况。

我个人更喜欢定义环境变量,而不是在快捷方式中硬编码路径。