当前位置:网站首页>Jupyter notebook service installation and startup

Jupyter notebook service installation and startup

2022-06-24 12:26:00 Goose

0. install

pip3 install jupyter

1. Generate a notebook The configuration file

jupyter notebook --generate-config

After execution, a configuration file will be generated , ~/.jupyter/jupyter_notebook_config.py

2. Set the password

$ jupyter notebook password
Enter password: ****
Verify password: ****
[NotebookPasswordApp] Wrote hashed password to ~/.jupyter/jupyter_notebook_config.json

3. modify jupyter_notebook_config.py

c.NotebookApp.ip='192.168.0.32'
c.NotebookApp.password = u'sha:ce... The ciphertext just copied '
c.NotebookApp.open_browser = False# Do not open the browser after starting the service 
c.NotebookApp.port =8888 # You can specify a port ,  Use this port when accessing 
The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'f:/nlp'## Set the startup directory to f:/nlp

4. Background operation

nohup jupyter notebook --allow-root > jupyter.log 2>&1 &

explain :

jupyter.log: Indicates that the standard output will be , Output to jupyter.log file

2>&1: Indicates that the error output is redirected to the label output

attach linux Definition and notebook Start command parameters :

/dev/null Represents an empty device file

0 Express stdin The standard input

1 Express stdout standard output

2 Express stderr The standard error

nohup Express no hang up, Just don't hang up , So after this command is executed, even if the terminal exits , And it won't stop .

jupyter notebook --h
usage: jupyter-notebook [-h] [--pylab [NOTEBOOKAPP.PYLAB]]
                        [--keyfile NOTEBOOKAPP.KEYFILE]
                        [--client-ca NOTEBOOKAPP.CLIENT_CA]
                        [--notebook-dir NOTEBOOKAPP.NOTEBOOK_DIR]
                        [--port-retries NOTEBOOKAPP.PORT_RETRIES]
                        [--config NOTEBOOKAPP.CONFIG_FILE]
                        [--certfile NOTEBOOKAPP.CERTFILE]
                        [--log-level NOTEBOOKAPP.LOG_LEVEL]
                        [--browser NOTEBOOKAPP.BROWSER]
                        [--transport KERNELMANAGER.TRANSPORT]
                        [--ip NOTEBOOKAPP.IP] [--port NOTEBOOKAPP.PORT] [-y]
                        [--script] [--no-mathjax] [--no-browser]
                        [--allow-root] [--debug] [--no-script]
                        [--generate-config]

optional arguments:
  -h, --help            show this help message and exit
  --pylab [NOTEBOOKAPP.PYLAB]
  --keyfile NOTEBOOKAPP.KEYFILE
  --client-ca NOTEBOOKAPP.CLIENT_CA
  --notebook-dir NOTEBOOKAPP.NOTEBOOK_DIR
  --port-retries NOTEBOOKAPP.PORT_RETRIES
  --config NOTEBOOKAPP.CONFIG_FILE
  --certfile NOTEBOOKAPP.CERTFILE
  --log-level NOTEBOOKAPP.LOG_LEVEL
  --browser NOTEBOOKAPP.BROWSER
  --transport KERNELMANAGER.TRANSPORT
  --ip NOTEBOOKAPP.IP
  --port NOTEBOOKAPP.PORT
  -y, --y
  --script
  --no-mathjax
  --no-browser
  --allow-root
  --debug
  --no-script
  --generate-config

Using shortcut keys

image.png
原网站

版权声明
本文为[Goose]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/06/20210602165101575I.html