当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当前回答
通常$ ipython notebook将在终端的当前工作目录下启动笔记本和内核。
但是如果你想指定启动目录,你可以使用——notebook-dir选项,如下所示:
$ ipython notebook——notebook-dir=/path/to/specific/directory
其他回答
除了@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'
通常$ ipython notebook将在终端的当前工作目录下启动笔记本和内核。
但是如果你想指定启动目录,你可以使用——notebook-dir选项,如下所示:
$ ipython notebook——notebook-dir=/path/to/specific/directory
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 change pwd时,这个问题不断出现,尽管我对笔记本电脑不感兴趣,但我对终端或qtconsole感兴趣。没有找到相关的配置项,我尝试了:
# lines of code to run at IPython startup.
c.InteractiveShellApp.exec_lines = ['%cd /home/paul/mypy']
这是基本的shell类;还有终端和控制台(可能还有笔记本)条目可以进一步定制操作。
从文档来看,import语句在条目中最常见,但似乎许多神奇的命令也能起作用。
对于Mac OS X,目标目录中有空格(后续使用@pheon)。在第2行$(…)周围添加额外的双引号。参见:https://stackoverflow.com/a/1308838(肖恩·布莱特)
#!/bin/bash
cd "$(dirname "$0")" && pwd
ipython notebook