Jupyter Notebook 保存場所 変更

Jupyter Notebookは、デフォルトではホームディレクトリに保存されますが、保存場所を変更することができます。

Jupyter Notebook 保存場所 変更

以下の手順に従って、Jupyter Notebookの保存場所を変更できます。

  1. Jupyter Notebookを起動します。

  2. ホーム画面で、「New」をクリックし、「Terminal」を選択します。

  3. ターミナルが開いたら、以下のコマンドを入力します。

jupyter notebook --generate-config
  1. 上記のコマンドを実行すると、Jupyter Notebookの設定ファイルである「jupyternotebookconfig.py」が生成されます。

  2. ターミナルで以下のコマンドを入力し、設定ファイルを開きます。

vi ~/.jupyter/jupyter_notebook_config.py
  1. 「i」キーを押して、編集モードに入ります。

  2. 設定ファイルの中で、以下の行を見つけます。

#c.NotebookApp.notebook_dir = ''
  1. 「#」を削除し、保存したい場所のパスを引用符で囲んで入力します。
c.NotebookApp.notebook_dir = '/path/to/new/directory'
  1. 「Esc」キーを押して、編集モードを終了します。

  2. 「:wq」と入力して、設定ファイルを保存して終了します。

これで、Jupyter Notebookの保存場所が変更されました。次回Jupyter Notebookを起動すると、新しい保存場所にアクセスできます。

Translated to English:

To change the default save location of Jupyter Notebook, follow these steps:

  1. Launch Jupyter Notebook.

  2. Click "New" on the home screen and select "Terminal."

  3. Once the terminal opens, enter the following command:

jupyter notebook --generate-config
  1. This will generate the Jupyter Notebook configuration file, "jupyternotebookconfig.py."

  2. In the terminal, enter the following command to open the configuration file:

vi ~/.jupyter/jupyter_notebook_config.py
  1. Press the "i" key to enter edit mode.

  2. In the configuration file, find the following line:

#c.NotebookApp.notebook_dir = ''
  1. Remove the "#" and enter the path to the desired save location in quotes:
c.NotebookApp.notebook_dir = '/path/to/new/directory'
  1. Press "Esc" to exit edit mode.

  2. Type ":wq" to save and exit the configuration file.

Now, the save location for Jupyter Notebook has been changed. The next time you launch Jupyter Notebook, it will access the new save location.

Stay up to date

Get notified when I publish New Games or articles, and unsubscribe at any time.

Thanks for joining!

Related video

FAQs

Jupyter Notebookの保存場所はどこですか?

デフォルトではホームディレクトリに保存されますが、手動で変更することができます。

設定ファイルを編集する方法は?

ターミナルから「vi ~/.jupyter/jupyter_notebook_config.py」と入力して、設定ファイルを開いて編集します。

コマンドの中にある引用符やスペースに注意すべきですか?

引用符やスペースは正確に入力する必要があります。タイプミスがあるとコマンドが機能しなくなります。

カレントディレクトリ外のNotebookを開く方法はありますか?

「File」→「Open」→「上部のアドレスバー」から直接パスを入力します。

大容量のNotebookファイルを開く場合、時間がかかりませんか?

大容量のNotebookでも、ロードする際にすべてのセルを読み込む必要はありません。必要な時点で読み込むオプションもあります。

Jupyter Notebookで使用可能な言語は何ですか?

Python以外にも、R, Julia, MATLABなどの言語が使用可能です。

Jupyter Notebookはオンラインでも使用できますか?

Jupyter Notebookはオンラインでもローカルでも使用可能です。ただし、オンラインの場合は、ブラウザからアクセスする必要があります。

セルの出力を消去する方法は?

「Kernel」→「Restart & Clear Output」を選択します。

セルの実行中にエラーが発生したらどうすればよいですか?

「Kernel」→「Interrupt」を選択して、処理を中断します。または、「Kernel」→「Restart & Clear Output」で、再起動してセルをクリアします。

ノートブックファイルをPDF形式に変換することはできますか?

「File」→「Download as」→「PDF via LaTeX (.pdf)」で変換できます。ただし、LaTeX環境が必要な場合があります。

What is the default save location for Jupyter Notebook?

The default save location for Jupyter Notebook is the home directory, but it can be manually changed.

How do I edit the configuration file?

Open the configuration file and edit it using the command “vi ~/.jupyter/jupyter_notebook_config.py” in the terminal.

Should I be careful with quotes and spaces in commands?

Yes, you should enter quotes and spaces accurately. Typos can cause the command to fail.

How can I open a Notebook file outside of my current directory?

Click “File” -> “Open” -> Enter path directly in the address bar.

Will it take a long time to load large Notebook files?

No, loading all cells of large Notebooks is not necessary. There are options to load them only when needed.

What languages are available for use in Jupyter Notebook besides Python?

Other languages such as R, Julia, MATLAB, etc. are also available for use in Jupyter Notebook.

Can I use Jupyter Notebook online?

Yes, Jupyter Notebook can be used online or locally. However, if online, access must be through a browser.

How do I clear cell output?

Select “Kernel” -> “Restart & Clear Output”.

What should I do if an error occurs while running a cell?

Select “Kernel” -> “Interrupt” to stop processing or select “Kernel” -> “Restart & Clear Output” to restart and clear cells.

Can I convert a notebook file to PDF format?

Yes. Click “File” -> “Download as” -> “PDF via LaTeX (.pdf)” to convert. However, a LaTeX environment may be required.

What is Jupyter Notebook?

Jupyter Notebook is an open-source web application used for creating and sharing documents that contain live code, equations, visualizations, and narrative text. It is also used for data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

How can I change the save location of Jupyter Notebook?

To change the save location of Jupyter Notebook, you need to configure the Jupyter Notebook server. You can do this by setting the c.NotebookApp.notebook_dir option in the configuration file.

Where can I find the configuration file for the Jupyter Notebook server?

The configuration file for the Jupyter Notebook server is usually located in the Jupyter config directory. You can find the location of this directory by running the command “jupyter –config-dir” in your terminal.

Can I specify the save location of a Jupyter Notebook for a single session?

Yes, you can specify the save location of a Jupyter Notebook for a single session by adding the “–notebook-dir” option when starting the Jupyter Notebook server. For example, you can start the server with the command “jupyter notebook –notebook-dir=/path/to/notebook/folder”.

How can I override the default configuration of the Jupyter Notebook server?

You can override the default configuration of the Jupyter Notebook server by creating a configuration file and specifying the relevant options. This file should be named “jupyter_notebook_config.py” and should be placed in the Jupyter config directory. You can then modify the options in this file to suit your needs.

Is it recommended to change the default save location of the Jupyter Notebook?

No, it is not recommended to change the default save location of the Jupyter Notebook, as it may cause issues with the functioning of the server.

What are some common uses of Jupyter Notebook in Python?

Jupyter Notebook is commonly used for data analysis and visualization, machine learning, numerical simulations, and scientific computing. It is also used for teaching and learning programming, as it allows for interactive experimentation and exploration of code.

Can Jupyter Notebook be used with other programming languages besides Python?

Yes, Jupyter Notebook can be used with other programming languages besides Python, including R, Julia, and Scala.

How can I use Jupyter Notebook to visualize data with Matplotlib?

You can use Jupyter Notebook to visualize data with Matplotlib by importing the Matplotlib library and using the appropriate functions to create and customize plots. For example, you can use the “matplotlib.pyplot” module to create basic plots like line charts, scatter plots, and bar charts.

Can Jupyter Notebook be used to work with data frames and tables?

Yes, Jupyter Notebook can be used to work with data frames and tables using libraries like Pandas and Numpy. These libraries allow you to import, manipulate, and analyze tabular data, and can be used to perform operations like aggregation, filtering, transformation, and visualization.

What are some best practices for working with Jupyter Notebook?

Some best practices for working with Jupyter Notebook include: keeping your code and output organized and well-documented, using version control with tools like Git, using the cache mechanism to speed up computations, and using the logging configuration to track errors and issues. It is also advisable to configure and override the default settings using a config file, and to keep your code clean and modular for easy maintainability.

How to change the save location of Jupyter Notebook?

To change the saved location of Jupyter Notebook, you can modify the configuration file. The configuration file is located at ~/.jupyter/jupyter_notebook_config.py. Add the following code to change the default save directory: c.NotebookApp.notebook_dir = ‘/desired/path/to/folder’

Can I save Jupyter Notebook in IPython instead of JupyterLab?

Yes, you can save a Jupyter Notebook in IPython. However, JupyterLab offers many more features and is recommended for most users.

What is JupyterLab URL?

The JupyterLab URL is the URL that you use to access JupyterLab. By default, the URL is http://localhost:8888/lab.

How can I access the JupyterLab API?

You can access the JupyterLab API by appending /api to the JupyterLab URL. For example, if your URL is http://localhost:8888/lab, the API URL would be http://localhost:8888/api.

How to load data into a DataFrame in Jupyter Notebook?

To load data into a DataFrame in Jupyter Notebook, you can use the pandas.read_csv() function. For example: import pandas as pd df = pd.read_csv(‘path/to/your/data’)

What is the maximum size of a static dictionary in Jupyter Notebook?

The maximum size of a static dictionary in Jupyter Notebook is 43.7 MB.

Can we customize Jupyter Notebook?

Yes, Jupyter Notebook can be customized using extensions. You can install extensions using pip or conda.

What does the “deprecate” keyword mean in Jupyter Notebook?

The “deprecate” keyword in Jupyter Notebook means that a particular feature will no longer be available or supported in future versions.

Can Jupyter Notebook be used for computational research?

Yes, Jupyter Notebook is commonly used for computational research in fields such as data science and machine learning.

Is Pylab package still recommended for use in Jupyter Notebook?

No, Pylab package is no longer recommended for use in Jupyter Notebook as it has been deprecated.

Related articles

Ruslan Osipov
Author: Ruslan Osipov