当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当前回答
我有一个非常有效的方法来保存笔记本在一个理想的位置在窗口。
一次性活动:确保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将是您的默认启动位置。)
要在OS X中的Windows上执行下面描述的相同技巧,请创建这个shell脚本
#!/bin/bash
cd $(dirname "$0") && pwd
ipython notebook
将其命名为ipython-notebook.command并使其可执行。
把它放到你想要工作的目录中,然后双击它。
对于Mac OS X,目标目录中有空格(后续使用@pheon)。在第2行$(…)周围添加额外的双引号。参见:https://stackoverflow.com/a/1308838(肖恩·布莱特)
#!/bin/bash
cd "$(dirname "$0")" && pwd
ipython 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.
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.