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

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

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


当前回答

如果你正在使用WinPython而不是anaconda,那么你需要导航到安装WinPython的目录,例如C:\WPy-3670\settings\.jupyter\jupyter_notebook_config.py

您需要编辑这个文件并找到这一行 # c.NotebookApp。Notebook_dir = "将其更改为例如。 c.NotebookApp。notebook_dir = 'D:/your_own_folder/ contains /jupyter_notes'

您还需要将反斜杠\改为正斜杠/。还要确保通过删除#来取消该行的注释

其他回答

经过多次尝试,我终于做到了。下面是我提到的最简单的步骤:

Right click on the jupyter launcher icon from start menu or desktop or anaconda navigator Now you need to change 2 things on the screen: Add your path to both target and start in the properties window Caveats: a. Your path needs to be in the same drive as the drive in which jupyter is installed. Since mine was in C drive, I used the following path "C:/JupyterWorkLibrary" b. For target, at the end of the existing path, i.e, after sript.py", add this after a space. Some people have mentioned removing %USERPROFILE% from target. I did not come across this. Image for jupyter properties c. For start in, add the same path. I have used a path without spaces to avoid issues. I would also suggest stick to using path in double quotes anyways d.I have also used forward slashes in the path Now just launch the notebook. It should open into the right folder.

希望这能有所帮助。

PS:我确信还有其他的方法,这对我来说很有效。我甚至不确定上面提到的约束条件。只是有了这些步骤,我可以完成我的工作。

截至2020年,对于Windows…

配置是用于miniconda的安装,但对于anaconda也是一样的。可以通过查看快捷方式的属性来修改它。链接的目标格式如下:

{1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88} {1ch88ff88

分为三个部分:

1:第一部分启动包装器

C: \用户\ A_User \ miniconda3 \ python . exe C: \用户\ A_User miniconda3 \ cwp . py

这个包装器确保第三部分(即实际的快捷方式)可以使用适当的配置执行,具体取决于选择的执行环境。代码在这里。

2:脚本文件夹的路径

脚本位于每个环境使用的文件夹的子文件夹Scripts中。给出所需环境的路径,包装器将完成其余工作。在我的情况下,我使用的基础环境:

C: \用户\ A_User \ miniconda3

这个片段被传递给脚本,该脚本将其标识为变量前缀,从变量计算出的完整路径,然后添加到环境变量path的开头,并替换CONDA_PREFIX的当前内容。

3:要执行的命令

这是前面的包装器要处理的命令:

C:用户\A_User\ python.exe:\用户\A_User\ \ scription \ ju_script .py“%用户资料%\文件文件\Jupyter”

它运行Python和Jupyter -notebook-script.py脚本来启动Jupyter notebook,并添加了特定的初始文件夹“%USERPROFILE%\Documents\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

这个方法可能与你的问题无关,但对我来说很有用。

只需在地址栏中输入“cmd”打开命令提示符,然后输入“jupyter notebook”。

通过这种方法,你可以快速打开蟒蛇jupyter从任何路径你目前停留在Windows系统。

对于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")