当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开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目录的。
其他回答
如果您在Windows中安装了最新版本的Python,则上层解决方案可能不适用于您。我已经安装了Python 3.6.0:: Anaconda 4.3.0(64位),我想更改名为Jupyter的iPython Notebook的工作目录,这就是它为我工作的方式。
步骤1:打开CMD并输入以下命令。
步骤1:CMD
步骤2:现在已经在.jupyter文件夹中生成了一个文件。对我来说,它是c:\用户\管理。jupyter。在那里您将找到一个名为jupyter_notebook_config.py的文件。右键单击并编辑它。添加以下一行并设置工作目录的路径。 在“I:\STUDY\Y2-Trimester-1\Modern Data Science”中设置自己的工作目录
我们做完了。现在你可以重新启动Jupyter Notebook了。希望这对你有用。谢谢
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.
要在OS X中的Windows上执行下面描述的相同技巧,请创建这个shell脚本
#!/bin/bash
cd $(dirname "$0") && pwd
ipython notebook
将其命名为ipython-notebook.command并使其可执行。
把它放到你想要工作的目录中,然后双击它。
对于linux和Windows: 只要修改一行,你就可以改变它。
1. Open file
cwp.py
in
C:\Users\[您的计算机名]\Anaconda2
.
2. find the line
os.chdir (documents_folder)
在文件的末尾。
改为
操作系统。Chdir(“您期望的工作文件夹”)
例如:os.chdir("D:/Jupyter_folder")
3. save and close.
它工作。
更新:
说到MacOS,我找不到ccp .py。 以下是我的发现:
打开你的Macbook终端,运行'jupyter notebook -generate-config'。
它将在/Users/[your_username]/.jupyter/jupyter_notebook_config.py目录下创建一个配置文件
打开配置文件,然后更改这一行#c.NotebookApp。Notebook_dir = " 来 c.NotebookApp。Notebook_dir = '你的路径' 记住这一行也要取消注释。
例如,我将路径更改为“/Users/catbuilts/JupyterProjects/”
通常$ ipython notebook将在终端的当前工作目录下启动笔记本和内核。
但是如果你想指定启动目录,你可以使用——notebook-dir选项,如下所示:
$ ipython notebook——notebook-dir=/path/to/specific/directory