Jupyter Notebook の初回起動時のワーキングディレクトリを変更

7月 26, 2020

# configファイルの作成
$ jupyter notebook --generate-config

# geditでconfigファイルを開き、c.NotebookApp.notebook_dirの変数に好きな場所に書き換える
$ gedit ~/.jupyter/jupyter_notebook_config.py
jupyter_notebook_config.pyの中身
~~~~~~~~~~~
## The login handler class to use.
#c.NotebookApp.login_handler_class = 'notebook.auth.login.LoginHandler'
## The logout handler class to use.
#c.NotebookApp.logout_handler_class = 'notebook.auth.logout.LogoutHandler'
## The MathJax.js configuration file that is to be used.
#c.NotebookApp.mathjax_config = 'TeX-AMS-MML_HTMLorMML-full,Safe'
## A custom url for MathJax.js. Should be in the form of a case-sensitive url to
#  MathJax, for example:  /static/components/MathJax/MathJax.js
#c.NotebookApp.mathjax_url = ''
## Dict of Python modules to load as notebook server extensions.Entry values can
#  be used to enable and disable the loading ofthe extensions. The extensions
#  will be loaded in alphabetical order.
#c.NotebookApp.nbserver_extensions = {}
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = '/hoge/script/' <- ここのパラメータを書き換える
## Whether to open in a browser after starting. The specific browser used is
#  platform dependent and determined by the python standard library `webbrowser`
#  module, unless it is overridden using the --browser (NotebookApp.browser)
#  configuration option.
#c.NotebookApp.open_browser = True
## Hashed password to use for web authentication.
#
#  To generate, type in a python/IPython shell:
#
#    from notebook.auth import passwd; passwd()
#
#  The string should be of the form type:salt:hashed-password.
#c.NotebookApp.password = ''
~~~~~~~~~~

Python

Posted by vastee