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

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


当前回答

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.

其他回答

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.

Windows 10

Look for the jupyter_notebook_config.py in C:\Users\your_user_name\.jupyter or look it up with cortana. If you don't have it, then go to the cmd line and type: jupyter notebook --generate-config Open the jupyter_notebook_config.py and do a ctrl-f search for: c.NotebookApp.notebook_dir Uncomment it by removing the #. Change it to: c.NotebookApp.notebook_dir = 'C:/your/new/path' Note: You can put a u in front of the first ', change \\\\ to /, or change the ' to ". I don't think it matters. Go to your Jupyter Notebook link and right click it. Select properties. Go to the Shortcut menu and click Target. Look for %USERPROFILE%. Delete it. Save. Restart Jupyter.

找到你的ipython二进制文件。如果你使用anaconda在mac上安装ipython-notebook,它很可能会在/Users/[name]/anaconda/bin/目录下

在那个目录下,而不是启动你的笔记本

./ipython notebook

添加——notebook-dir=<unicode>选项。

./ipython notebook --notebook-dir=u'../rel/path/to/your/python-notebooks'

我在ipython bin目录中使用bashscript启动我的笔记本:

DIR=$(dirname $0)
$DIR/ipython notebook --notebook-dir=u'../rel/path/to/your/python-notebooks'

注意-到notebook目录的路径是相对于ipython bin目录的。

我将在这里补充一长串的答案。如果您在Windows上/使用Anaconda3,我通过转到文件/Scripts/ipython-script.py完成了这一点,并添加了这些行

import os
os.chdir(<path to desired dir>)

排队前

sys.exit(IPython.start_ipython())

操作系统Windows 10 蟒蛇2018年版

通过配置文件更改jupyter笔记本的工作目录:

打开cmd提示符(或Anaconda提示符),然后输入'jupyter notebook—generate-config'并按enter 这将自动创建一个文件'jupyter_notebook_config'在'C:\Users\username. config'jupyter \ '文件夹 查找创建的文件'jupyter_notebook_config'并编辑它。 查找#c.NotebookApp。Notebook_dir = " 把你想要的路径放在双引号内,它变成。>c。notebookapp。notebook_dir = 'D:/my_folder/jupiter' 注意使用了正斜杠(/),并且删除了注释(#)。

因此,

#c.NotebookApp.notebook_dir = '' 

编辑成

c.NotebookApp.notebook_dir = 'D:/your/desired/path'

让我们修改Jupyter Notebook快捷图标的路径 6.0在开始菜单中,右键单击快捷方式,打开文件夹位置。 6.1进入文件夹后,建议创建一个Jupyter快捷方式的副本, 6.2右键单击新的快捷图标打开属性,

最后,

6.3在目标文本框中,删除路径末尾的%USERPROFILE%,超长路径应该以jupyter-notebook-script.py结束

搜索我的视频 Jupyter笔记本-更改工作文件夹路径从默认到所需的路径