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

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


当前回答

根据官方Jupyter笔记本文档更改

USERPROFILE %

到文件夹路径

文档链接

3.1.1. 更改Jupyter Notebook启动文件夹(Windows)

将Jupyter Notebook启动器从菜单复制到桌面。 右键单击新的启动器并更改目标字段,将%USERPROFILE%更改为包含所有笔记本的文件夹的完整路径。 双击Jupyter Notebook桌面启动器(图标显示[IPy]),启动Jupyter Notebook应用程序。笔记本界面将出现在一个新的浏览器窗口或选项卡中。辅助终端窗口(仅用于错误记录和关机)也将打开。

其他回答

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

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中使用ipython,那么按照以下步骤:

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

对于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笔记本文档更改

USERPROFILE %

到文件夹路径

文档链接

3.1.1. 更改Jupyter Notebook启动文件夹(Windows)

将Jupyter Notebook启动器从菜单复制到桌面。 右键单击新的启动器并更改目标字段,将%USERPROFILE%更改为包含所有笔记本的文件夹的完整路径。 双击Jupyter Notebook桌面启动器(图标显示[IPy]),启动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快捷键来执行。