当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当前回答
操作系统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笔记本-更改工作文件夹路径从默认到所需的路径
其他回答
通常$ ipython notebook将在终端的当前工作目录下启动笔记本和内核。
但是如果你想指定启动目录,你可以使用——notebook-dir选项,如下所示:
$ ipython notebook——notebook-dir=/path/to/specific/directory
对于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/”
在命令行输入“jupyter notebook”之前导航到所需的文件夹。
在我的情况下,我所有的python文件都在“D:\ python”。
然后输入命令“jupyter notebook”,你就有了它。您已经更改了工作目录。
我有32位和64位的python和使用WinPython的ipython,我想要32位和64位的版本指向ipython笔记本的相同工作目录。
我按照上面的建议在这里,我仍然无法让我的设置工作。
以下是我所做的——以防有人需要:
看起来Ipython notebook使用了来自C:\pythonPath\winpythonPath\settings\.ipython\profile_default的配置
尽管ipython locate返回C:\users\Username\.ipython
因此,修改ipython_notebook_config.py文件并没有改变我的工作目录。
另外,ipython profile_create没有在C:\pythonPath\winpythonPath\settings\.ipython\profile_default中创建所需的python文件
我相信有更好的方法,但为了快速解决这个问题,我从C:\users\Username\复制了编辑好的python文件。C:\pythonPath\winpythonPath\settings\.ipython\profile_default
现在(终于)ipython notebook 64位运行并为我提供正确的工作目录
注意在Windows上,我对以下语法没有问题:
c.NotebookApp.notebook_dir = u'C:/Users/Path_to_working_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.