操作方法

操作方法:更改 Jupyter Notebook 的默认启动目录

Last Published: July 21, 2023

摘要

By default, the start directory for Jupyter Notebook used in ArcGIS API for Python is set to the following folder:

C:\Users\<User>

However, it is possible to start the Jupyter Notebook with a different directory through the Python Command Prompt or by modifying the Jupyter Notebook .py configuration file.

过程

Use one of the solutions provided to start Jupyter Notebook in a different directory.

Temporarily start Jupyter Notebook in a different directory using the Python Command Prompt

  1. Start the Python Command Prompt. Click Start > ArcGIS > Python Command Prompt.
  2. Run the following command. The command opens Jupyter Notebook with the defined directory.
jupyter notebook --notebook-dir [LOCATION]
The image of the Python Command Prompt with the command to start the Notebook in a different directory

Change the default directory by generating a config file

  1. Start the Python Command Prompt by clicking Start > ArcGIS > Python Command Prompt.
  2. Type the command below to create a config folder.
jupyter notebook --generate-config
The image of the Python Command Prompt with the command to create the config file
  1. Navigate to the following folder location:
C:\Users\[USER]\.jupyter
  1. Open the jupyter_notebook_config.py file using a text editor, for example, Notepad++.
  2. Search for the comment, The directory to use for notebooks and kernels.
  3. Uncomment the line below it by removing the # symbol, and insert the desired directory. For example:
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = r'C:\Users\User\Desktop\Work\test'
The image of the jupyter_notebook_config file
  1. Run Jupyter Notebook using the Python Command Prompt using the jupyter notebook command.

文章 ID: 000018832

接收通知并查找新问题或常见问题的解决方案

从我们全新的 AI 聊天机器人中获得简明答案和视频解决方案。

下载 Esri 支持应用程序

相关信息

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项