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

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


当前回答

找到你的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目录的。

其他回答

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.

当我搜索ipython change pwd时,这个问题不断出现,尽管我对笔记本电脑不感兴趣,但我对终端或qtconsole感兴趣。没有找到相关的配置项,我尝试了:

# lines of code to run at IPython startup.
c.InteractiveShellApp.exec_lines = ['%cd /home/paul/mypy']

这是基本的shell类;还有终端和控制台(可能还有笔记本)条目可以进一步定制操作。

从文档来看,import语句在条目中最常见,但似乎许多神奇的命令也能起作用。

找到你的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目录的。

只需在CMD中切换到首选目录,因此如果您在

C:\Users\USERNAME>

像这样改变路径

C:\Users\USERNAME>cd D:\MyProjectFolder

CMD光标将移动到此文件夹

D:\MyProjectFolder>

接下来你可以呼叫木星

D:\MyProjectFolder>jupyter notebook

如果你在windows中使用ipython,那么按照以下步骤:

在程序中导航到ipython notebook,并右键单击它和 进入属性。 在快捷选项卡中,将“开始”目录更改为您所需的目录 目录中。 重新启动内核。