Jupyter 工具的安装与使用方法,jupyter运行python代码演示,好用的python编辑器推荐!

时间:2022-07-25
本文章向大家介绍Jupyter 工具的安装与使用方法,jupyter运行python代码演示,好用的python编辑器推荐!,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

第一章:环境搭建

先给大家看下代码自动补齐功能的效果图:

① Jupyter 工具的安装

cmd 里执行下面的命令即可安装工具。

C:UsersAdministrator>pip install jupyter

② Jupyter 服务的启动

通过 jupyter notebook 启动环境,启用环境后这个窗口不要关闭。 快捷键 ctrl+c 可以停用服务。

③ Python 代码运行演示

通过启动服务时显示的端口即可访问环境。

写完代码后点击运行即可看到效果。

第二章:详细过程展示

① Jupyter 详细安装过程展示

详细安装过程如下:

C:UsersAdministrator>pip install jupyter
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting jupyter
  Downloading https://mirrors.aliyun.com/pypi/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
Collecting ipykernel
  Downloading https://mirrors.aliyun.com/pypi/packages/52/19/c2812690d8b340987eecd2cbc18549b1d130b94c5d97fcbe49f5f8710edf/ipykernel-5.3.4-py3-none-any.whl (120 kB)
     |████████████████████████████████| 120 kB 1.1 MB/s
Collecting notebook
  Downloading https://mirrors.aliyun.com/pypi/packages/ea/00/1be79c61e2dfedb29c430b0e08f9fd2cb6ee4f6be92ba6f185dd6bb00052/notebook-6.1.3-py3-none-any.whl (9.4 MB)
     |████████████████████████████████| 9.4 MB 544 kB/s
Collecting nbconvert
  Downloading https://mirrors.aliyun.com/pypi/packages/79/6c/05a569e9f703d18aacb89b7ad6075b404e8a4afde2c26b73ca77bb644b14/nbconvert-5.6.1-py2.py3-none-any.whl (455 kB)
     |████████████████████████████████| 455 kB 598 kB/s
Collecting qtconsole
  Downloading https://mirrors.aliyun.com/pypi/packages/42/63/08c241c351d527089083002f65905b81457fc5849fb87cafb08f2a00b354/qtconsole-4.7.5-py2.py3-none-any.whl (118 kB)
     |████████████████████████████████| 118 kB 1.6 MB/s
Collecting ipywidgets
  Downloading https://mirrors.aliyun.com/pypi/packages/56/a0/dbcf5881bb2f51e8db678211907f16ea0a182b232c591a6d6f276985ca95/ipywidgets-7.5.1-py2.py3-none-any.whl (121 kB)
     |████████████████████████████████| 121 kB 2.2 MB/s
Collecting jupyter-console
  Downloading https://mirrors.aliyun.com/pypi/packages/0a/89/742fa5a80b552ffcb6a8922712697c6e6828aee7b91ee4ae2b79f00f8401/jupyter_console-6.1.0-py2.py3-none-any.whl (21 kB)
Collecting traitlets>=4.1.0
  Downloading https://mirrors.aliyun.com/pypi/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl (75 kB)
     |████████████████████████████████| 75 kB 2.6 MB/s
Collecting tornado>=4.2
  Downloading https://mirrors.aliyun.com/pypi/packages/30/38/91349845eea916575ddbe59a08866de3661b1e4564d42a845545066d51c4/tornado-6.0.4-cp38-cp38-win32.whl (416 kB)
     |████████████████████████████████| 416 kB 2.2 MB/s
Collecting jupyter-client
  Downloading https://mirrors.aliyun.com/pypi/packages/48/2e/6d48ae4ef0c9aa1383b3186349472a01bb38dacb2162a4a4370525d3f2a4/jupyter_client-6.1.6-py3-none-any.whl (108 kB)
     |████████████████████████████████| 108 kB 1.7 MB/s
Collecting ipython>=5.0.0
  Downloading https://mirrors.aliyun.com/pypi/packages/e7/ba/0ea438e2acd68ce79fde9cf57b4b1f18386969d8a013cd549254b151dde1/ipython-7.17.0-py3-none-any.whl (786 kB)
     |████████████████████████████████| 786 kB 2.2 MB/s
Collecting ipython-genutils
  Downloading https://mirrors.aliyun.com/pypi/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB)
Collecting terminado>=0.8.3
  Downloading https://mirrors.aliyun.com/pypi/packages/ff/96/1d9a2c23990aea8f8e0b5c3b6627d03196a73771a17a2d9860bbe9823ab6/terminado-0.8.3-py2.py3-none-any.whl (33 kB)
Collecting prometheus-client
  Downloading https://mirrors.aliyun.com/pypi/packages/3f/0e/554a265ffdc56e1494ef08e18f765b0cdec78797f510c58c45cf37abb4f4/prometheus_client-0.8.0-py2.py3-none-any.whl (53 kB)
     |████████████████████████████████| 53 kB 2.0 MB/s
Collecting jupyter-core>=4.6.1
  Downloading https://mirrors.aliyun.com/pypi/packages/63/0d/df2d17cdf389cea83e2efa9a4d32f7d527ba78667e0153a8e676e957b2f7/jupyter_core-4.6.3-py2.py3-none-any.whl (83 kB)
     |████████████████████████████████| 83 kB 2.9 MB/s
Collecting jinja2
  Downloading https://mirrors.aliyun.com/pypi/packages/30/9e/f663a2aa66a09d838042ae1a2c5659828bb9b41ea3a6efa20a20fd92b121/Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
     |████████████████████████████████| 125 kB 2.2 MB/s
Collecting nbformat
  Downloading https://mirrors.aliyun.com/pypi/packages/4d/d1/b568bd35f95321f152f594b3647cd080e96d3347843ff2fa34dce871b8bf/nbformat-5.0.7-py3-none-any.whl (170 kB)
     |████████████████████████████████| 170 kB 1.1 MB/s
Collecting Send2Trash
  Downloading https://mirrors.aliyun.com/pypi/packages/49/46/c3dc27481d1cc57b9385aff41c474ceb7714f7935b1247194adae45db714/Send2Trash-1.5.0-py3-none-any.whl (12 kB)
Collecting argon2-cffi
  Downloading https://mirrors.aliyun.com/pypi/packages/35/cf/a963fe123b1ec720a47954051c13fe4b9c7eecc232add29e0d9a8fa5ebe8/argon2_cffi-20.1.0-cp38-cp38-win32.whl (38 kB)
Collecting pyzmq>=17
  Downloading https://mirrors.aliyun.com/pypi/packages/05/65/22eb2a3f456b27d6a1795483fb79aa358c3d1cf065979048939c2317ab21/pyzmq-19.0.2-cp38-cp38-win32.whl (901 kB)
     |████████████████████████████████| 901 kB 3.3 MB/s
Collecting defusedxml
  Downloading https://mirrors.aliyun.com/pypi/packages/06/74/9b387472866358ebc08732de3da6dc48e44b0aacd2ddaa5cb85ab7e986a2/defusedxml-0.6.0-py2.py3-none-any.whl (23 kB)
Collecting testpath
  Downloading https://mirrors.aliyun.com/pypi/packages/1b/9e/1a170feaa54f22aeb5a5d16c9015e82234275a3c8ab630b552493f9cb8a9/testpath-0.4.4-py2.py3-none-any.whl (163 kB)
     |████████████████████████████████| 163 kB 2.2 MB/s
Collecting pandocfilters>=1.4.1
  Downloading https://mirrors.aliyun.com/pypi/packages/4c/ea/236e2584af67bb6df960832731a6e5325fd4441de001767da328c33368ce/pandocfilters-1.4.2.tar.gz (14 kB)
Collecting bleach
  Downloading https://mirrors.aliyun.com/pypi/packages/9a/1e/7d6cb3b27cd2c490558349ca5d5cc05b390b017da1c704cac807ac8bd9fb/bleach-3.1.5-py2.py3-none-any.whl (151 kB)
     |████████████████████████████████| 151 kB 2.2 MB/s
Collecting mistune<2,>=0.8.1
  Downloading https://mirrors.aliyun.com/pypi/packages/09/ec/4b43dae793655b7d8a25f76119624350b4d65eb663459eb9603d7f1f0345/mistune-0.8.4-py2.py3-none-any.whl (16 kB)
Collecting pygments
  Downloading https://mirrors.aliyun.com/pypi/packages/2d/68/106af3ae51daf807e9cdcba6a90e518954eb8b70341cee52995540a53ead/Pygments-2.6.1-py3-none-any.whl (914 kB)
     |████████████████████████████████| 914 kB 2.2 MB/s
Collecting entrypoints>=0.2.2
  Downloading https://mirrors.aliyun.com/pypi/packages/ac/c6/44694103f8c221443ee6b0041f69e2740d89a25641e62fb4f2ee568f2f9c/entrypoints-0.3-py2.py3-none-any.whl (11 kB)
Collecting qtpy
  Downloading https://mirrors.aliyun.com/pypi/packages/cd/fd/9972948f02e967b691cc0ca1f26124826a3b88cb38f412a8b7935b8c3c72/QtPy-1.9.0-py2.py3-none-any.whl (54 kB)
     |████████████████████████████████| 54 kB 660 kB/s
Collecting widgetsnbextension~=3.5.0
  Downloading https://mirrors.aliyun.com/pypi/packages/6c/7b/7ac231c20d2d33c445eaacf8a433f4e22c60677eb9776c7c5262d7ddee2d/widgetsnbextension-3.5.1-py2.py3-none-any.whl (2.2 MB)
     |████████████████████████████████| 2.2 MB 595 kB/s
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0
  Downloading https://mirrors.aliyun.com/pypi/packages/72/65/a3ef98b56d57a6d0a04cea5810ecbf3700a225d296ca298b3442dddebb42/prompt_toolkit-3.0.6-py3-none-any.whl (354 kB)
     |████████████████████████████████| 354 kB 30 kB/s
Collecting six
  Downloading https://mirrors.aliyun.com/pypi/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting decorator
  Downloading https://mirrors.aliyun.com/pypi/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting python-dateutil>=2.1
  Downloading https://mirrors.aliyun.com/pypi/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
     |████████████████████████████████| 227 kB 2.2 MB/s
Collecting pickleshare
  Downloading https://mirrors.aliyun.com/pypi/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting colorama; sys_platform == "win32"
  Downloading https://mirrors.aliyun.com/pypi/packages/c9/dc/45cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl (15 kB)
Collecting backcall
  Downloading https://mirrors.aliyun.com/pypi/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Collecting jedi>=0.10
  Downloading https://mirrors.aliyun.com/pypi/packages/c3/d4/36136b18daae06ad798966735f6c3fb96869c1be9f8245d2a8f556e40c36/jedi-0.17.2-py2.py3-none-any.whl (1.4 MB)
     |████████████████████████████████| 1.4 MB 2.2 MB/s
Requirement already satisfied: setuptools>=18.5 in d:python3.85-32libsite-packages (from ipython>=5.0.0->ipykernel->jupyter) (47.1.0)
Collecting pywinpty>=0.5; os_name == "nt"
  Downloading https://mirrors.aliyun.com/pypi/packages/5d/97/8e43c2152a638cdb83d45644eb125c752abe67249f94bb3e3e29b0709685/pywinpty-0.5.7.tar.gz (49 kB)
     |████████████████████████████████| 49 kB 1.5 MB/s
Collecting pywin32>=1.0; sys_platform == "win32"
  Downloading https://mirrors.aliyun.com/pypi/packages/4c/6d/e47d8020c21849498d84fb9f75e4d7ab3414eebacb85fa7e1d61e34fae67/pywin32-228-cp38-cp38-win32.whl (8.4 MB)
     |████████████████████████████████| 8.4 MB 2.2 MB/s
Collecting MarkupSafe>=0.23
  Downloading https://mirrors.aliyun.com/pypi/packages/93/b8/95b1c38f5b00ed2c0d16cf65f2b07a5ae73eeacf66d2010c0e934737d1d9/MarkupSafe-1.1.1-cp38-cp38-win32.whl (16 kB)
Collecting jsonschema!=2.5.0,>=2.4
  Downloading https://mirrors.aliyun.com/pypi/packages/c5/8f/51e89ce52a085483359217bc72cdbf6e75ee595d5b1d4b5ade40c7e018b8/jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
     |████████████████████████████████| 56 kB 1.3 MB/s
Collecting cffi>=1.0.0
  Downloading https://mirrors.aliyun.com/pypi/packages/fd/0e/ecabb5a445b249c3b19aa38f2e68c2dba9a05c1553d5d3ae3d51fe12e4db/cffi-1.14.1-cp38-cp38-win32.whl (166 kB)
     |████████████████████████████████| 166 kB 3.2 MB/s
Collecting packaging
  Downloading https://mirrors.aliyun.com/pypi/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl (37 kB)
Collecting webencodings
  Downloading https://mirrors.aliyun.com/pypi/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting wcwidth
  Downloading https://mirrors.aliyun.com/pypi/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting parso<0.8.0,>=0.7.0
  Downloading https://mirrors.aliyun.com/pypi/packages/93/d1/e635bdde32890db5aeb2ffbde17e74f68986305a4466b0aa373b861e3f00/parso-0.7.1-py2.py3-none-any.whl (109 kB)
     |████████████████████████████████| 109 kB 3.2 MB/s
Collecting pyrsistent>=0.14.0
  Downloading https://mirrors.aliyun.com/pypi/packages/9f/0d/cbca4d0bbc5671822a59f270e4ce3f2195f8a899c97d0d5abb81b191efb5/pyrsistent-0.16.0.tar.gz (108 kB)
     |████████████████████████████████| 108 kB 2.2 MB/s
Collecting attrs>=17.4.0
  Downloading https://mirrors.aliyun.com/pypi/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Collecting pycparser
  Downloading https://mirrors.aliyun.com/pypi/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 2.2 MB/s
Collecting pyparsing>=2.0.2
  Downloading https://mirrors.aliyun.com/pypi/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
     |████████████████████████████████| 67 kB 1.3 MB/s
Using legacy setup.py install for pandocfilters, since package 'wheel' is not installed.
Using legacy setup.py install for pywinpty, since package 'wheel' is not installed.
Using legacy setup.py install for pyrsistent, since package 'wheel' is not installed.
Installing collected packages: ipython-genutils, six, decorator, traitlets, tornado, python-dateutil, pyzmq, pywin32, jupyter-core, jupyter-client, pickleshare, wcwidth, prompt-toolkit, colorama, pygments, backcall, parso, jedi, ipython, ipykernel, defusedxml, testpath, pandocfilters, pyparsing, packaging, webencodings, bleach, mistune, MarkupSafe, jinja2, pyrsistent, attrs, jsonschema, nbformat, entrypoints, nbconvert, pywinpty, terminado, prometheus-client, Send2Trash, pycparser, cffi, argon2-cffi, notebook, qtpy, qtconsole, widgetsnbextension, ipywidgets, jupyter-console, jupyter
    Running setup.py install for pandocfilters ... done
    Running setup.py install for pyrsistent ... done
    Running setup.py install for pywinpty ... done
Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 argon2-cffi-20.1.0 attrs-19.3.0 backcall-0.2.0 bleach-3.1.5 cffi-1.14.1 colorama-0.4.3 decorator-4.4.2 defusedxml-0.6.0 entrypoints-0.3 ipykernel-5.3.4 ipython-7.17.0 ipython-genutils-0.2.0 ipywidgets-7.5.1 jedi-0.17.2 jinja2-2.11.2 jsonschema-3.2.0 jupyter-1.0.0 jupyter-client-6.1.6 jupyter-console-6.1.0 jupyter-core-4.6.3 mistune-0.8.4 nbconvert-5.6.1 nbformat-5.0.7 notebook-6.1.3 packaging-20.4 pandocfilters-1.4.2 parso-0.7.1 pickleshare-0.7.5 prometheus-client-0.8.0 prompt-toolkit-3.0.6 pycparser-2.20 pygments-2.6.1 pyparsing-2.4.7 pyrsistent-0.16.0 python-dateutil-2.8.1 pywin32-228 pywinpty-0.5.7 pyzmq-19.0.2 qtconsole-4.7.5 qtpy-1.9.0 six-1.15.0 terminado-0.8.3 testpath-0.4.4 tornado-6.0.4 traitlets-4.3.3 wcwidth-0.2.5 webencodings-0.5.1 widgetsnbextension-3.5.1

② Jupyter 服务启动详细过程展示

详细服务启动过程如下:

C:UsersAdministrator>jupyter notebook
[W 17:08:05.045 NotebookApp] Terminals not available (error was No module named 'winpty.cywinpty')
[I 17:08:05.046 NotebookApp] Serving notebooks from local directory: C:UsersAdministrator
[I 17:08:05.047 NotebookApp] Jupyter Notebook 6.1.3 is running at:
[I 17:08:05.048 NotebookApp] http://localhost:8888/?token=9d98f4d1416403b57242bdefe39431e8ad851fd789032d3f
[I 17:08:05.048 NotebookApp]  or http://127.0.0.1:8888/?token=9d98f4d1416403b57242bdefe39431e8ad851fd789032d3f
[I 17:08:05.049 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:08:05.073 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/nbserver-12540-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=9d98f4d1416403b57242bdefe39431e8ad851fd789032d3f
     or http://127.0.0.1:8888/?token=9d98f4d1416403b57242bdefe39431e8ad851fd789032d3f