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

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


当前回答

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

C:\Users\USERNAME>

像这样改变路径

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

CMD光标将移动到此文件夹

D:\MyProjectFolder>

接下来你可以呼叫木星

D:\MyProjectFolder>jupyter notebook

其他回答

在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上的iPython Notebook中,这对我来说很有效:

cd d:\folder\

只需遵循官方网站上的指南,也复制在下面。对于第一步,而不是复制启动器,您只需转到开始菜单并右键单击打开位置。

Copy the Jupyter Notebook launcher from the menu to the desktop. Right click on the new launcher and change the “Start in” field by pasting the full path of the folder which will contain all the notebooks. Double-click on the Jupyter Notebook desktop launcher (icon shows [IPy]) to start the Jupyter Notebook App, which will open in a new browser window (or tab). Note also that a secondary terminal window (used only for error logging and for shut down) will be also opened. If only the terminal starts, try opening this address with your browser: http://localhost:8888/.

操作系统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笔记本-更改工作文件夹路径从默认到所需的路径

除了@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'