我试着按照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

其他回答

这个问题已经很老了,而且似乎已经解决了,但如果只是为了提醒自己下次遇到这个问题,这里有另一个解决方案(不过只在Windows 10上测试)。

jupyter笔记本的快捷方式(从开始菜单,桌面快捷方式或固定到任务栏)调用许多脚本(大概是初始化jupyter笔记本等),这是写在目标文本字段从快捷方式的属性窗口。 附加

--notebook-dir='C:/Your/Desired/Start/Directory/'

应该在指定的目录下启动笔记本(正如@Victor O指出的那样,它不能是驱动器,但必须是文件夹)。 如果这还不能解决问题,也可以在Start in字段中添加相同的目录。

注意:我在Target字段中使用了正斜杠,在Start in字段中使用了反斜杠。如果你好奇哪种组合是有效的,可以随意改变。

另外,这不是我的想法,但我忘记了它来自哪里(我检查了之前安装的快捷方式,因为我确定没有尝试过这个页面的任何东西,而是从OP提供的链接中建议的方法。)如果有人想提供链接,请提供。

很抱歉我不能在此基础上添加任何研究,但这个解决方案在四个独立的系统上都适用,而且实现起来相当简单。

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

[1]  cd e:

通过以下方法进行测试:

[2] pwd

您可以从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

尝试导航到要运行jupyter笔记本文件的文件夹。 在资源管理器中单击右键,然后单击“在终端中打开” 然后键入命令jupyter notebook以从所需位置运行notebook。