当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username

我如何将其更改为另一个位置?


当前回答

只需遵循官方网站上的指南,也复制在下面。对于第一步,而不是复制启动器,您只需转到开始菜单并右键单击打开位置。

Copy the Jupyter Notebook launcher from the menu to the desktop. Right click on the new launcher and change the “Start in” field by pasting the full path of the folder which will contain all the notebooks. Double-click on the Jupyter Notebook desktop launcher (icon shows [IPy]) to start the Jupyter Notebook App, which will open in a new browser window (or tab). Note also that a secondary terminal window (used only for error logging and for shut down) will be also opened. If only the terminal starts, try opening this address with your browser: http://localhost:8888/.

其他回答

在命令行输入“jupyter notebook”之前导航到所需的文件夹。

在我的情况下,我所有的python文件都在“D:\ python”。

然后输入命令“jupyter notebook”,你就有了它。您已经更改了工作目录。

根据官方Jupyter笔记本文档更改

USERPROFILE %

到文件夹路径

文档链接

3.1.1. 更改Jupyter Notebook启动文件夹(Windows)

将Jupyter Notebook启动器从菜单复制到桌面。 右键单击新的启动器并更改目标字段,将%USERPROFILE%更改为包含所有笔记本的文件夹的完整路径。 双击Jupyter Notebook桌面启动器(图标显示[IPy]),启动Jupyter Notebook应用程序。笔记本界面将出现在一个新的浏览器窗口或选项卡中。辅助终端窗口(仅用于错误记录和关机)也将打开。

This might help someone who doesn't want to change config file. If you are on Windows/ using Anaconda3, go to Win Start ->Search for Jupyter Notebook(env). Click on it and the Jupyter opens up. On Jupyter webpage, on right hand side go to New -> Terminal and the terminal window opens up. In this terminal windows change the directory to the working directory, using cd command. Example: cd "c:\User\<user-name>\workingdir". Now in the same terminal window type Jupyter-notebook, this will open Jupyter with the working directory we used in cd command above.

要在OS X中的Windows上执行下面描述的相同技巧,请创建这个shell脚本

#!/bin/bash
cd $(dirname "$0") && pwd
ipython notebook

将其命名为ipython-notebook.command并使其可执行。

把它放到你想要工作的目录中,然后双击它。

通常$ ipython notebook将在终端的当前工作目录下启动笔记本和内核。

但是如果你想指定启动目录,你可以使用——notebook-dir选项,如下所示:

$ ipython notebook——notebook-dir=/path/to/specific/directory