Как изменить папку запуска jupyter

Common Directories and File Locations#

Jupyter stores different files (i.e. configuration, data, runtime) in a number of different locations. Environment variables may be set to customize for the location of each file type.

Jupyter separates data files (nbextensions, kernelspecs) from runtime files (logs, pid files, connection files) from configuration (config files, custom.js).

Configuration files#

Config files are stored by default in the

Set this environment variable to use a particular directory, other than the default, for Jupyter config files.

Besides the JUPYTER_CONFIG_DIR , additional directories to search can be specified through JUPYTER_CONFIG_PATH .

Set this environment variable to provide extra directories for the config search path. JUPYTER_CONFIG_PATH should contain a series of directories, separated by « os.pathsep« ( ; on Windows, : on Unix).

An example of where the JUPYTER_CONFIG_PATH can be set is if notebook or server extensions are installed in a custom prefix. Since notebook and server extensions are automatically enabled through configuration files, automatic enabling will only work if the custom prefix’s etc/jupyter directory is added to the Jupyter config search path.

Besides the user config directory mentioned above, Jupyter has a search path of additional locations from which a config file will be loaded. Here’s a table of the locations to be searched, in order of preference:

To list the config directories currently being used you can run the below command from the command line :

The following command shows the config directory specifically:

Data files#

Jupyter uses a search path to find installable data files, such as kernelspecs and notebook extensions. When searching for a resource, the code will search the search path starting at the first directory until it finds where the resource is contained.

Each category of file is in a subdirectory of each directory of the search path. For example, kernel specs are in kernels subdirectories.

Set this environment variable to provide extra directories for the data search path. JUPYTER_PATH should contain a series of directories, separated by os.pathsep ( ; on Windows, : on Unix). Directories given in JUPYTER_PATH are searched before other locations. This is used in addition to other entries, rather than replacing any.

Linux (& other free desktops)

/.local/share/jupyter/ (respects $XDG_DATA_HOME )

JUPYTER_DATA_DIR or (if not set) %APPDATA%\jupyter

The config directory for Jupyter data files, which contain non-transient, non-configuration files. Examples include kernelspecs, nbextensions, or voila templates.

Set this environment variable to use a particular directory, other than the default, as the user data directory.

As mentioned above, to list the config directories currently being used you can run the below command from the command line :

The following command shows the data directory specifically:

Runtime files#

Things like connection files, which are only useful for the lifetime of a particular process, have a runtime directory.

On Linux and other free desktop platforms, these runtime files are stored in $XDG_RUNTIME_DIR/jupyter by default. On other platforms, it’s a runtime/ subdirectory of the user’s data directory (second row of the table above).

An environment variable may also be used to set the runtime directory.

Set this to override where Jupyter stores runtime files.

As mentioned above, to list the config directories currently being used you can run the below command from the command line :

Русские Блоги

Четыре способа изменить рабочий путь Jupyter Notebook по умолчанию в Anaconda

Описание: Три способа изменить рабочий путь по умолчанию для Jupyter Notebook в Anaconda

Способ 1.

  • Откройте cmd для Windows и введите cmd jupyter notebook —generate-config Как показано ниже:
     y/N N
    Вы видите путь D: \ Users . Найдите этот путь и измените файл jupyter_notebook_config.py

    Откройте этот файл и найдите

## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = »
измените его на
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = ‘E:\Jupyter’
где E: \ Jupyter — мое рабочее пространство, вы можете изменить его на свое,
Примечание:

1. #c.NotebookApp.notebook_dir = » # В # должен быть удален без пробелов.
2.E: \ Jupyter, папка Jupyter должна быть создана заранее. Если она не будет создана, Jupyter Notebook не сможет найти этот файл и произойдет сбой.

Способ 2

Найдите ярлык, созданный Анакондой

  • Щелкните правой кнопкой мыши свойство, чтобы ввести и изменить начальный адрес на E: \ Jupyter, и тогда приложение выполнится успешно.

Способ 3

  • Откройте файл etc в каталоге установки Anaconda, например: C: \ Anaconda3 \ etc \ jupyter Мой каталог установки находится в C: \ Anaconda3
  • Затем откройте файл jupyter_notebook_config.json и измените его следующим образом:

Пожалуйста, нажмите на полный текстовый адрес: https://blog.csdn.net/u014552678/article/details/62046638?utm_source=copy

Четвертый метод — тот, который я видел раньше. Я не могу вспомнить источник. Я подведу итоги еще раз:

Способ 4.

Этот метод подходит для установки Python с использованием anaconda. Введите cmd в поле поиска на панели задач Windows, а затем нажмите Anaconda Prompt в результатах поиска, чтобы открыть командную строку anaconda.

Сначала введите букву диска, у меня E:, затем нажмите Enter, чтобы переключиться на указанный диск, а затем перейдите в рабочий каталог, например, E: / Jupyter, а затем введите jupyter-notebook. Различные команды запуска jupyter могут отличаться Нужно подтвердить

Это мой рабочий каталог

Открой Anaconda Prompt

После запуска jupyter, Home автоматически открывается в браузере, и вы видите, что рабочий каталог переключен на мой рабочий каталог.

How to change the working directory of Jupyter and Jupyter Lab on Windows environment

Make sure you use forward slashes in your path , backslashes could be used if placed in double quotes even if folder name contains spaces as such : "D:\yourUserName\Any Folder\More Folders\"

6. Remove the # at the beginning of the line to allow the line to execute. Save the file.

7. Open cmd (or Anaconda Prompt) and run jupyter lab . You will see your home directory being set to the new path.

How to change the Jupyter Notebook default directory

When I first started using notebooks, one of the letdowns was that I wasn’t able to navigate upwards out of the installation folder. I save all my projects on an extra internal hard disk drive, both for safety and portability. It’s also never a bad idea to have an additional backup (besides GitHub). Accessing these projects through my (Anaconda) Jupyter Notebooks seemed to be impossible. However, several solutions have been proposed on StackOverflow and other boards. Here’s a quick overview.

Throughout this blog post I’ll be using D:/python/foo as project folder. My Anaconda environment is data_science.

Solution 1: navigate to the folder and run Jupyter

The first solution is straightforward. You simply activate your environment, you browse to your project folder in the Anaconda Prompt, and you run Jupyter notebooks. It’s not a one-time solution. Every time you want to work on your project, you’ll have to retake these steps.

Solution 2: set the notebook-dir parameter

A faster solution (just one line of code) is to set the notebook-dir parameter when starting Jupyter notebook.

Solution 3: edit the configuration file

A more permanent solution is editing the Jupyter configuration file. By running the following command in your Anaconda prompt, a file will be created (jupyter_notebook_config.py in your Jupyter installation folder).

In this file, you’ll find c.NotebookApp.notebook_dir after a hash. Uncomment the line by removing the hash and set the value to the directory of your projects.

Now run Jupyter Notebook from the Anaconda prompt (or the Navigator), and you’ll start from your preferred directory. Keep in mind that you’ve changed the directory for every environment.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *