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

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

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


当前回答

jupyter notebook --notebook-dir=%WORKING_DIR%,

where %WORKING_DIR% (H:\data\ML) -你要工作的目录

恕我直言,这是最简单的单行命令方式

其他回答

您可以从conda命令行更改配置:

运行anaconda命令提示符 运行jupyter notebook—generate-config 你应该在家里创建一个目录。jupyter/,文件是jupyter_notebook_config.py 取消注释并编辑字段c.NotebookApp.notebook_dir

感谢克莱门特https://groups.google.com/a/continuum.io/forum/#!主题/蟒蛇/ gqRwT_SxGBw

I've just installed Anaconda on Windows 10 and have been trying to configure Jupyter to open in my specified directory, including updating the Jupyter config file as suggested above. This didn't work. After viewing other threads, I stumbled on file "notebook.bat" in the .anaconda\scripts\ folder. This launches Jupyter. I took a copy of the .bat file into the folder I want to work in, ran it, and voila - Jupyter launches in that folder and I no longer see every folder on my PC, just the one I want. One desktop shortcut later and I'm a happy 'non-techy'. I hope this helps.

你可以使用Lopesoft的FileMenuTools程序作为命令提示符,只需输入“jupyter notebook”。

或者,你也可以用它来创建一个专用的快捷方式,使用程序C:/windows/System32/cmd.exe和参数/k jupyter notebook——notebook-dir="%FOLDERPATH%",但这会打开父文件夹中的笔记本,所以你必须点击下。

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

我刚刚把我的项目移植到wsl,运行ubuntu 20+。我也需要在Win中使用文件位置,除了notebook_dir(上面有很好的文档),还有浏览器重定向的问题,应该从默认行为中改变。这个答案与笔记本服务器无关。

配置文件的生成在前面的响应中处理;所以我就不在这里描述了。请在

浏览器重定向的默认行为需要停止,因此您应该设置c.NotebookApp。use_redirect_file = False 设置您的首选工作目录;在我的情况下,我使用挂载驱动器,所以c.NotebookApp。notebook_dir ="/mnt/<mount_point>/<目录的全路径,使用/和no: >/"

这使得笔记本可以在首选的Win目录上无缝启动。