当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当前回答
除了@Matt的方法之外,更改笔记本永久使用的默认目录的一种方法是更改配置文件。首先在cmdline中输入:
$> ipython profile create
使用默认配置文件初始化配置文件。其次,在ipython_notebook_config.py文件中,取消注释并编辑这一行:
# c.NotebookManager.notebook_dir = 'D:\\Documents\\Desktop'
更改D:\\Documents\\Desktop到您喜欢的任何路径。
这对我来说很有用;)
更新:没有c.NotebookManager。notebook_dir了。 现在,取消注释和配置的行是这样的: c.NotebookApp。notebook_dir = 'Z:\\username_example\folder_that_you_whant'
其他回答
在命令行输入“jupyter notebook”之前导航到所需的文件夹。
在我的情况下,我所有的python文件都在“D:\ python”。
然后输入命令“jupyter notebook”,你就有了它。您已经更改了工作目录。
通常$ ipython notebook将在终端的当前工作目录下启动笔记本和内核。
但是如果你想指定启动目录,你可以使用——notebook-dir选项,如下所示:
$ ipython notebook——notebook-dir=/path/to/specific/directory
我有一个非常有效的方法来保存笔记本在一个理想的位置在窗口。
一次性活动:确保jupyter-notebook.exe的路径为 保存在环境变量下。 从windows资源管理器或cd打开所需的目录 从命令提示符 从所需文件夹上的windows资源管理器中选择地址 Bar(以完全选择路径标签的方式)并输入jupyter-notebook.exe 瞧! !笔记本从上面打开 所需的文件夹和任何新的笔记本将保存在这个位置。
Jupyter笔记本——help-all可能会有帮助:
--notebook-dir=<Unicode> (NotebookManager.notebook_dir)
Default: u'/Users/me/ipynbs'
The directory to use for notebooks.
例如:
jupyter notebook --notebook-dir=/Users/yourname/folder1/folder2/
如果需要,你当然可以在你的配置文件中设置它,你可能需要在Windows中转义反斜杠。
注意,这将覆盖您在jupyter_notebook_config.py文件中设置的任何路径。(在这里你可以设置一个变量c.NotebookApp。Notebook_dir将是您的默认启动位置。)
只需遵循官方网站上的指南,也复制在下面。对于第一步,而不是复制启动器,您只需转到开始菜单并右键单击打开位置。
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/.