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

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

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


当前回答

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

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

其他回答

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

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

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

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

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

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

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

jupyter初学者指南中列出了最佳和最简单的方法: [https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html] 它有Windows和Mac的解决方案,Mac的解决方案也适用于Ubuntu或任何linux发行版。

希望对大家有帮助。我试着把这个作为评论,但我们有足够的声望点。

如果你的目标是永久性地改变创业地点。您可以通过更改笔记本的快捷方式来实现这一点。假设你用的是Windows 10

按下开始并在Anaconda文件夹中找到Jupter Notebook 右键单击->更多->打开文件位置 右键点击Jupyter笔记本短可爱->属性 现在在目标中:您将在末尾看到类似于“%USERPROFILE%/”的内容。将%USERPROFILE%/的内容替换为所需的目录。如。“D: \ GoogleDrive”

祝你好运

你可以像这样制作windows bat文件。

D: (your dexired drive)
cd \Your\Desired\Start\Derectory
Jupyter notebook

保存为“JupyterNB.bat”(或任何你喜欢的),并双击它。

这就是我在Windows上为Jupyter/Anaconda所做的。这个方法 还传递给jupyter一个python配置脚本。我用它来添加一个路径到我的项目父文件夹:

在某个地方创建jnote.bat:

@echo off
call activate %1
call jupyter notebook "%CD%" %2 %3
pause

在同一个文件夹中创建一个windows快捷方式jupyter-notebook

        TARGET: D:\util\jnote.bat py3-jupyter --config=jupyter_notebook_config.py
        START IN: %CD%

将jupyter图标添加到快捷方式。

在jupyter projects文件夹中执行以下操作:

创建jupyter_notebook_config.py,把你喜欢的东西放在这里:

import os
import sys
import inspect

# Add parent folder to sys path

currentdir = os.path.dirname(os.path.abspath(
    inspect.getfile(inspect.currentframe())))

parentdir = os.path.dirname(currentdir)

os.environ['PYTHONPATH'] = parentdir

然后粘贴jupyte -notebook快捷方式。双击 快捷键和你的jupyter就会亮起来,包裹就会放进去 父文件夹将可用。