准备工作

需要事先安装好Python环境。

[root@localhost ~]# python3 --version
Python 3.8.0
[root@localhost ~]# pip3 --version
pip 19.2.3 from /usr/local/python3/lib/python3.8/site-packages/pip (python 3.8)

安装工作


第一步:安装ipython

[root@localhost ~]# pip3 install ipython
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
Collecting ipython
  Downloading https://mirrors.aliyun.com/pypi/packages/37/e7/f0603980140976fe6c998dcd30a559dd8a3e1bfd4a9358c27411e33de6d9/ipython-7.20.0-py3-none-any.whl (784kB)
    100% |████████████████████████████████| 788kB 1.3MB/s 
Collecting decorator (from ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl
Collecting traitlets>=4.2 (from ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/f6/7d/3ecb0ebd0ce8dcdfa7bd47ab85c1d4a521e6770ef283d0824f5804994dfe/traitlets-5.0.5-py3-none-any.whl (100kB)
    100% |████████████████████████████████| 102kB 1.5MB/s 
Collecting pickleshare (from ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl
Collecting pexpect>4.3; sys_platform != "win32" (from ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl (59kB)
    100% |████████████████████████████████| 61kB 1.7MB/s 
Collecting jedi>=0.16 (from ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/f9/36/7aa67ae2663025b49e8426ead0bad983fee1b73f472536e9790655da0277/jedi-0.18.0-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.4MB/s 
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 (from ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/4e/f4/805f4596bf15ae8e576623f579b40c12b0780a7bdd9a437f205f136d9ece/prompt_toolkit-3.0.14-py3-none-any.whl (359kB)
    100% |████████████████████████████████| 368kB 1.5MB/s 
Collecting pygments (from ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/17/e3/c7ea888bd6e9849c60b1f378637850265177ed01297137f544a7ecf7d7ba/Pygments-2.7.4-py3-none-any.whl (950kB)
    100% |████████████████████████████████| 952kB 1.2MB/s 
Requirement already satisfied: setuptools>=18.5 in /usr/local/python3.7/lib/python3.7/site-packages (from ipython) (40.8.0)
Collecting backcall (from ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl
Collecting ipython-genutils (from traitlets>=4.2->ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting ptyprocess>=0.5 (from pexpect>4.3; sys_platform != "win32"->ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/22/a6/858897256d0deac81a172289110f31629fc4cee19b6f01283303e18c8db3/ptyprocess-0.7.0-py2.py3-none-any.whl
Collecting parso<0.9.0,>=0.8.0 (from jedi>=0.16->ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/ad/f0/ef6bdb1eba2dbfda60c985cd8d7b47b6ed8c6a1f5d212f39ff50b64f172c/parso-0.8.1-py2.py3-none-any.whl (93kB)
    100% |████████████████████████████████| 102kB 1.6MB/s 
Collecting wcwidth (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython)
  Downloading https://mirrors.aliyun.com/pypi/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whl
Installing collected packages: decorator, ipython-genutils, traitlets, pickleshare, ptyprocess, pexpect, parso, jedi, wcwidth, prompt-toolkit, pygments, backcall, ipython
Successfully installed backcall-0.2.0 decorator-4.4.2 ipython-7.20.0 ipython-genutils-0.2.0 jedi-0.18.0 parso-0.8.1 pexpect-4.8.0 pickleshare-0.7.5 prompt-toolkit-3.0.14 ptyprocess-0.7.0 pygments-2.7.4 traitlets-5.0.5 wcwidth-0.2.5

第二步:安装Notebook

[root@localhost ~]# pip3 install notebook
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
Collecting notebook
  Downloading https://mirrors.aliyun.com/pypi/packages/74/19/50cd38acf22e33370d01fef764355f1e3517f6e12b4fceb8d434ece4f8fd/notebook-6.2.0-py3-none-any.whl (9.5MB)
    100% |████████████████████████████████| 9.5MB 1.3MB/s 
Collecting nbconvert (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/13/2f/acbe7006548f3914456ee47f97a2033b1b2f3daf921b12ac94105d87c163/nbconvert-6.0.7-py3-none-any.whl (552kB)
    100% |████████████████████████████████| 552kB 1.3MB/s 
Collecting jinja2 (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/7e/c2/1eece8c95ddbc9b1aeb64f5783a9e07a286de42191b7204d67b7496ddf35/Jinja2-2.11.3-py2.py3-none-any.whl (125kB)
    100% |████████████████████████████████| 133kB 1.3MB/s 
Requirement already satisfied: traitlets>=4.2.1 in /usr/local/python3.7/lib/python3.7/site-packages (from notebook) (5.0.5)
Collecting prometheus-client (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/f4/7e/ef341c67ed43ad2e39633a35c28b77bc555f9572f4df4fee11c2b467db00/prometheus_client-0.9.0-py2.py3-none-any.whl (53kB)
    100% |████████████████████████████████| 61kB 2.0MB/s 
Collecting terminado>=0.8.3 (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/de/74/604d9dcbb5b73b54d07c78764b22568b8c7923d93e257dc9766142f67b81/terminado-0.9.2-py3-none-any.whl
Collecting pyzmq>=17 (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/4d/85/a0c77b07da35cbd85266a5cb4e7308ecf92c3fe59f87e5e42f9ffbb3f45e/pyzmq-22.0.2-cp37-cp37m-manylinux1_x86_64.whl (1.1MB)
    100% |████████████████████████████████| 1.1MB 1.4MB/s 
Collecting nbformat (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/13/1d/59cbc5a6b627ba3b4c0ec5ccc82a9002e58b324e2620a4929b81f1f8d309/nbformat-5.1.2-py3-none-any.whl (113kB)
    100% |████████████████████████████████| 122kB 1.5MB/s 
Collecting jupyter-core>=4.6.1 (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/53/40/5af36bffa0af3ac71d3a6fc6709de10e4f6ff7c01745b8bc4715372189c9/jupyter_core-4.7.1-py3-none-any.whl (82kB)
    100% |████████████████████████████████| 92kB 1.7MB/s 
Collecting argon2-cffi (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/e0/d7/5da06217807106ed6d7b4f5ccb8ec5e3f9ec969217faad4b5d1af0b55101/argon2_cffi-20.1.0-cp35-abi3-manylinux1_x86_64.whl (97kB)
    100% |████████████████████████████████| 102kB 1.5MB/s 
Collecting jupyter-client>=5.3.4 (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/83/d6/30aed7ef13ff3f359e99626c1b0a32ebbc3bf9b9d5616ec46e9e245d5fa9/jupyter_client-6.1.11-py3-none-any.whl (108kB)
    100% |████████████████████████████████| 112kB 1.3MB/s 
Requirement already satisfied: ipython-genutils in /usr/local/python3.7/lib/python3.7/site-packages (from notebook) (0.2.0)
Collecting ipykernel (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/7d/cc/e8908bbb2921732f6851ebbbe4b77b925aab62e644ab9402f21c84fa6107/ipykernel-5.4.3-py3-none-any.whl (120kB)
    100% |████████████████████████████████| 122kB 1.4MB/s 
Collecting Send2Trash>=1.5.0 (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/49/46/c3dc27481d1cc57b9385aff41c474ceb7714f7935b1247194adae45db714/Send2Trash-1.5.0-py3-none-any.whl
Collecting tornado>=6.1 (from notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/91/a8/9c5902233fa3c2e6a889cbd164333ddda5009669f494e3fadbeee2c03af5/tornado-6.1-cp37-cp37m-manylinux2010_x86_64.whl (428kB)
    100% |████████████████████████████████| 430kB 1.4MB/s 
Collecting nbclient<0.6.0,>=0.5.0 (from nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/e5/e9/cb88ef8fe390439637ea68c5abdf5f490cbf5ad2edbf612b6e03cd30cbf3/nbclient-0.5.2-py3-none-any.whl (65kB)
    100% |████████████████████████████████| 71kB 1.7MB/s 
Collecting testpath (from nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/1b/9e/1a170feaa54f22aeb5a5d16c9015e82234275a3c8ab630b552493f9cb8a9/testpath-0.4.4-py2.py3-none-any.whl (163kB)
    100% |████████████████████████████████| 174kB 1.5MB/s 
Collecting entrypoints>=0.2.2 (from nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/ac/c6/44694103f8c221443ee6b0041f69e2740d89a25641e62fb4f2ee568f2f9c/entrypoints-0.3-py2.py3-none-any.whl
Collecting defusedxml (from nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/06/74/9b387472866358ebc08732de3da6dc48e44b0aacd2ddaa5cb85ab7e986a2/defusedxml-0.6.0-py2.py3-none-any.whl
Collecting bleach (from nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/f0/46/2bbd92086a4c6f051214cb48df6d9132b5f32c5e881d3f4991b16ec7e499/bleach-3.3.0-py2.py3-none-any.whl (283kB)
    100% |████████████████████████████████| 286kB 1.4MB/s 
Collecting jupyterlab-pygments (from nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/a8/6f/c34288766797193b512c6508f5994b830fb06134fdc4ca8214daba0aa443/jupyterlab_pygments-0.1.2-py2.py3-none-any.whl
Collecting mistune<2,>=0.8.1 (from nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/09/ec/4b43dae793655b7d8a25f76119624350b4d65eb663459eb9603d7f1f0345/mistune-0.8.4-py2.py3-none-any.whl
Collecting pandocfilters>=1.4.1 (from nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/28/78/bd59a9adb72fa139b1c9c186e6f65aebee52375a747e4b6a6dcf0880956f/pandocfilters-1.4.3.tar.gz
Requirement already satisfied: pygments>=2.4.1 in /usr/local/python3.7/lib/python3.7/site-packages (from nbconvert->notebook) (2.7.4)
Collecting MarkupSafe>=0.23 (from jinja2->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/c2/37/2e4def8ce3739a258998215df907f5815ecd1af71e62147f5eea2d12d4e8/MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl
Requirement already satisfied: ptyprocess; os_name != "nt" in /usr/local/python3.7/lib/python3.7/site-packages (from terminado>=0.8.3->notebook) (0.7.0)
Collecting jsonschema!=2.5.0,>=2.4 (from nbformat->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/c5/8f/51e89ce52a085483359217bc72cdbf6e75ee595d5b1d4b5ade40c7e018b8/jsonschema-3.2.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 1.8MB/s 
Collecting cffi>=1.0.0 (from argon2-cffi->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/71/47/debced71573d0e023039c96b38d68b23bd454536a28f83a9c6533b5c5a81/cffi-1.14.4-cp37-cp37m-manylinux1_x86_64.whl (402kB)
    100% |████████████████████████████████| 409kB 1.3MB/s 
Collecting six (from argon2-cffi->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting python-dateutil>=2.1 (from jupyter-client>=5.3.4->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
    100% |████████████████████████████████| 235kB 1.5MB/s 
Requirement already satisfied: ipython>=5.0.0 in /usr/local/python3.7/lib/python3.7/site-packages (from ipykernel->notebook) (7.20.0)
Collecting async-generator (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/71/52/39d20e03abd0ac9159c162ec24b93fbcaa111e8400308f2465432495ca2b/async_generator-1.10-py3-none-any.whl
Collecting nest-asyncio (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/52/e2/9b37da54e6e9094d2f558ae643d1954a0fa8215dfee4fa261f31c5439796/nest_asyncio-1.5.1-py3-none-any.whl
Collecting packaging (from bleach->nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/3e/89/7ea760b4daa42653ece2380531c90f64788d979110a2ab51049d92f408af/packaging-20.9-py2.py3-none-any.whl (40kB)
    100% |████████████████████████████████| 40kB 2.0MB/s 
Collecting webencodings (from bleach->nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /usr/local/python3.7/lib/python3.7/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook) (40.8.0)
Collecting pyrsistent>=0.14.0 (from jsonschema!=2.5.0,>=2.4->nbformat->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/4d/70/fd441df751ba8b620e03fd2d2d9ca902103119616f0f6cc42e6405035062/pyrsistent-0.17.3.tar.gz (106kB)
    100% |████████████████████████████████| 112kB 1.4MB/s 
Collecting importlib-metadata; python_version < "3.8" (from jsonschema!=2.5.0,>=2.4->nbformat->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/f3/ed/da40116a204abb5c4dd1d929346d33e0d29cedb2cedd18ea98f0385dcd92/importlib_metadata-3.4.0-py3-none-any.whl
Collecting attrs>=17.4.0 (from jsonschema!=2.5.0,>=2.4->nbformat->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/c3/aa/cb45262569fcc047bf070b5de61813724d6726db83259222cd7b4c79821a/attrs-20.3.0-py2.py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 1.9MB/s 
Collecting pycparser (from cffi>=1.0.0->argon2-cffi->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112kB)
    100% |████████████████████████████████| 112kB 1.3MB/s 
Requirement already satisfied: pickleshare in /usr/local/python3.7/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook) (0.7.5)
Requirement already satisfied: pexpect>4.3; sys_platform != "win32" in /usr/local/python3.7/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook) (4.8.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/python3.7/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook) (3.0.14)
Requirement already satisfied: decorator in /usr/local/python3.7/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook) (4.4.2)
Requirement already satisfied: backcall in /usr/local/python3.7/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook) (0.2.0)
Requirement already satisfied: jedi>=0.16 in /usr/local/python3.7/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->notebook) (0.18.0)
Collecting pyparsing>=2.0.2 (from packaging->bleach->nbconvert->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl (67kB)
    100% |████████████████████████████████| 71kB 1.6MB/s 
Collecting typing-extensions>=3.6.4; python_version < "3.8" (from importlib-metadata; python_version < "3.8"->jsonschema!=2.5.0,>=2.4->nbformat->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata; python_version < "3.8"->jsonschema!=2.5.0,>=2.4->nbformat->notebook)
  Downloading https://mirrors.aliyun.com/pypi/packages/41/ad/6a4f1a124b325618a7fb758b885b68ff7b058eec47d9220a12ab38d90b1f/zipp-3.4.0-py3-none-any.whl
Requirement already satisfied: wcwidth in /usr/local/python3.7/lib/python3.7/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.0.0->ipykernel->notebook) (0.2.5)
Requirement already satisfied: parso<0.9.0,>=0.8.0 in /usr/local/python3.7/lib/python3.7/site-packages (from jedi>=0.16->ipython>=5.0.0->ipykernel->notebook) (0.8.1)
Installing collected packages: pyrsistent, six, typing-extensions, zipp, importlib-metadata, attrs, jsonschema, jupyter-core, nbformat, async-generator, tornado, python-dateutil, pyzmq, jupyter-client, nest-asyncio, nbclient, testpath, entrypoints, defusedxml, pyparsing, packaging, webencodings, bleach, jupyterlab-pygments, MarkupSafe, jinja2, mistune, pandocfilters, nbconvert, prometheus-client, terminado, pycparser, cffi, argon2-cffi, ipykernel, Send2Trash, notebook
  Running setup.py install for pyrsistent ... done
  Running setup.py install for pandocfilters ... done
Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 argon2-cffi-20.1.0 async-generator-1.10 attrs-20.3.0 bleach-3.3.0 cffi-1.14.4 defusedxml-0.6.0 entrypoints-0.3 importlib-metadata-3.4.0 ipykernel-5.4.3 jinja2-2.11.3 jsonschema-3.2.0 jupyter-client-6.1.11 jupyter-core-4.7.1 jupyterlab-pygments-0.1.2 mistune-0.8.4 nbclient-0.5.2 nbconvert-6.0.7 nbformat-5.1.2 nest-asyncio-1.5.1 notebook-6.2.0 packaging-20.9 pandocfilters-1.4.3 prometheus-client-0.9.0 pycparser-2.20 pyparsing-2.4.7 pyrsistent-0.17.3 python-dateutil-2.8.1 pyzmq-22.0.2 six-1.15.0 terminado-0.9.2 testpath-0.4.4 tornado-6.1 typing-extensions-3.7.4.3 webencodings-0.5.1 zipp-3.4.0

第三步:检查安装

[root@localhost ~]# pip3 show notebook
Name: notebook
Version: 6.1.6
Summary: A web-based notebook environment for interactive computing
Home-page: http://jupyter.org
Author: Jupyter Development Team
Author-email: jupyter@googlegroups.com
License: BSD
Location: /usr/local/python3/lib/python3.8/site-packages
Requires: ipykernel, terminado, ipython-genutils, prometheus-client, jupyter-client, jinja2, tornado, jupyter-core, Send2Trash, nbconvert, argon2-cffi, traitlets, nbformat, pyzmq
Required-by:
[root@localhost ~]# pip3 show ipython
Name: ipython
Version: 7.16.1
Summary: IPython: Productive Interactive Computing
Home-page: https://ipython.org
Author: The IPython Development Team
Author-email: ipython-dev@python.org
License: BSD
Location: /usr/local/python3/lib/python3.8/site-packages
Requires: pexpect, traitlets, jedi, pygments, backcall, decorator, pickleshare, prompt-toolkit, setuptools
Required-by: ipykernel

配置工作


初始化配置

执行以下命令会在/root/.jupyter/jupyter_notebook_config.py生成对应的初始化配置文件。

[root@localhost ~]# jupyter notebook --generate-config --allow-root
Writing default config to: /root/.jupyter/jupyter_notebook_config.py

免密码登录

[root@localhost bin]# ipython
Python 3.8.0 (default, Jan  4 2021, 16:37:17) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: passwd()                                                                                
Enter password: 
Verify password: 
Out[2]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$faTPkKy8bxfrlFmMMhUnOQ$qcKW7ubpxSuWRoRp/kYdJA'

配置介绍

注意:修改刚刚完成创建的初始化配置文件。

vim /root/.jupyter/jupyter_notebook_config.py

1.c.NotebookApp.ip = '0.0.0.0'

允许外部登录,去掉注释,并把localhost改成0.0.0.0,这样就可以外部访问了,默认只有在本机可以访问的;
c.NotebookApp.ip = '0.0.0.0'

2.c.NotebookApp.allow_root = False

允许root登录,去掉行注释,并修改成True即可解决root权限运行的问题。

3.c.NotebookApp.notebook_dir = ""

改成如下,这样就会默认把notebook上创建的文件保存到指定目录下;需要事先创建。
c.NotebookApp.notebook_dir = '/opt/jupyter'

4.c.NotebookApp.password = ""

加入上面创建的密码即可完成免密登录。

启动


1.启动服务

[root@localhost ~]# jupyter notebook --no-browser
[I 11:14:45.529 NotebookApp] The port 8888 is already in use, trying another port.
[I 11:14:45.529 NotebookApp] The port 8889 is already in use, trying another port.
[I 11:14:45.531 NotebookApp] Serving notebooks from local directory: /opt/jupyter/workespace
[I 11:14:45.531 NotebookApp] Jupyter Notebook 6.1.6 is running at:
[I 11:14:45.531 NotebookApp] http://localhost.localdomain:8890/
[I 11:14:45.531 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

image.png

到此Python3安装Notebook已完成。

最后修改:2021 年 02 月 14 日 11 : 25 AM
如果觉得我的文章对你有用,请随意赞赏