当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当前回答
当从命令行启动时,IPython Notebook将使用您的当前工作目录。我利用了这一点,创建了上下文菜单项,直接从Windows资源管理器打开它。不需要快捷方式或批处理脚本!
我的灵感来自于Git for Windows创建的基于注册表的“Git GUI Here/Git Bash Here”条目。这个页面(链接了存档版本)有助于定位正确的键。
第一对是没有任何选择的上下文菜单(例如目录背景)。笔记本将以当前目录作为工作目录打开。
Key: HKCR\Directory\Background\shell\ipythonnb
Value: &IPython Notebook Here
Key: HKCR\Directory\Background\shell\ipythonnb\command
Value: "<full path to IPython notebook>" "%v"
这一对用于单击文件夹时显示的上下文菜单。笔记本将以所选文件夹作为工作目录打开。
Key: HKCR\Directory\shell\ipythonnb
Value: &IPython Notebook Here
Key: HKCR\Directory\shell\ipythonnb\command
Value: "<full path to IPython notebook>" "%1"
注意%v vs %1参数,否则它将不起作用。也不要忘记引用。在我的平台上,IPython Notebook的完整路径是C:\WinPython-32bit-2.7.6.4\IPython Notebook.exe,但这个值显然取决于您的安装。
编辑:AFAICT完整路径是必需的,即使可执行文件在系统路径上。
其他回答
通常$ ipython notebook将在终端的当前工作目录下启动笔记本和内核。
但是如果你想指定启动目录,你可以使用——notebook-dir选项,如下所示:
$ ipython notebook——notebook-dir=/path/to/specific/directory
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下MiniConda2/Anaconda2上修改Jupyter或iPython工作目录,可以修改此文件:
C:\Program Files\Miniconda2\cwp.py
并添加项目文件夹位置:development_folder= 'C:\Users\USERNAME\Development' 这是我的用户名\开发在我的情况下。
还需要将:os.chdir(documents_folder)更改为os.chdir(development_folder)
try:
documents_folder = get_folder_path(FOLDERID.Documents)
development_folder= 'C:\Users\USERNAME\Development'
except PathNotFoundException:
documents_folder = get_folder_path(FOLDERID.PublicDocuments)
os.chdir(development_folder)
subprocess.call(args, env=env)
通过使用常规的Jupiter Notebook快捷键来执行。
操作系统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笔记本-更改工作文件夹路径从默认到所需的路径
如果您在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了。希望这对你有用。谢谢