jupyter notebook 的安装

在前面,准备写写笔记,一方面督促自己学习,毕竟是想在相关方向发展的人,另一方面也当作技术分享吧,让后面的人少走弯路。

基本思路就是从基本的环境搭建到方法技术的学习。

为降低成本,只会写得精简。


 

jupyter notebook 的安装

jupyter notebook 安装方法网上一搜一大堆,个人更倾向于官方的(这是链接)。

官方很简单一个命令搞定,因为我用 conda 来管理包,所以我 activate 环境后,只需要这个命令:

conda install -c conda-forge notebook

安装完毕后,输入命令即可打开浏览器进入 notebook :

jupyter notebook

但事与愿违,浏览器没弹出来,反而在终端出现一堆的文字:

The Jupyter HTML Notebook.



This launches a Tornado based HTML Notebook Server that serves up an

HTML5/Javascript Notebook client.



Subcommands

-----------



Subcommands are launched as `jupyter-notebook cmd [args]`. For information on

using subcommand 'cmd', do: `jupyter-notebook cmd -h`.



list

    List currently running notebook servers.

stop

    Stop currently running notebook server for a given port

password

    Set a password for the notebook server.



Options

-------



Arguments that take values are actually convenience aliases to full

Configurables, whose aliases are listed on the help line. For more information

on full configurables, see '--help-all'.



--debug

    set log level to logging.DEBUG (maximize logging output)

--generate-config

    generate default config file

-y

    Answer yes to any questions instead of prompting.

--no-browser

    Don't open the notebook in a browser after startup.

--pylab

    DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.

--no-mathjax

    Disable MathJax



    MathJax is the javascript library Jupyter uses to render math/LaTeX. It is

    very large, so you may want to disable it if you have a slow internet

    connection, or for offline use of the notebook.



    When disabled, equations etc. will appear as their untransformed TeX source.

--allow-root

    Allow the notebook to be run from root user.

--script

    DEPRECATED, IGNORED

--no-script

    DEPRECATED, IGNORED

--log-level=<Enum> (Application.log_level)

    Default: 30

    Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')

    Set the log level by value or name.

--config=<Unicode> (JupyterApp.config_file)

    Default: ''

    Full path of a config file.

--ip=<Unicode> (NotebookApp.ip)

    Default: 'localhost'

    The IP address the notebook server will listen on.

--port=<Int> (NotebookApp.port)

    Default: 8888

    The port the notebook server will listen on.

--port-retries=<Int> (NotebookApp.port_retries)

    Default: 50

    The number of additional ports to try if the specified port is not

    available.

--transport=<CaselessStrEnum> (KernelManager.transport)

    Default: 'tcp'

    Choices: ['tcp', 'ipc']

--keyfile=<Unicode> (NotebookApp.keyfile)

    Default: ''

    The full path to a private key file for usage with SSL/TLS.

--certfile=<Unicode> (NotebookApp.certfile)

    Default: ''

    The full path to an SSL/TLS certificate file.

--client-ca=<Unicode> (NotebookApp.client_ca)

    Default: ''

    The full path to a certificate authority certificate for SSL/TLS client

    authentication.

--notebook-dir=<Unicode> (NotebookApp.notebook_dir)

    Default: ''

    The directory to use for notebooks and kernels.

--browser=<Unicode> (NotebookApp.browser)

    Default: ''

    Specify what command to use to invoke a web browser when opening the

    notebook. If not specified, the default browser will be determined by the

    `webbrowser` standard library module, which allows setting of the BROWSER

    environment variable to override it.

--pylab=<Unicode> (NotebookApp.pylab)

    Default: 'disabled'

    DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.

--gateway-url=<Unicode> (GatewayClient.url)

    Default: None

    The url of the Kernel or Enterprise Gateway server where kernel

    specifications are defined and kernel management takes place. If defined,

    this Notebook server acts as a proxy for all kernel management and kernel

    specification retrieval.  (JUPYTER_GATEWAY_URL env var)



To see all available configurables, use `--help-all`



Examples

--------



    jupyter notebook                       # start the notebook

    jupyter notebook --certfile=mycert.pem # use SSL/TLS certificate

    jupyter notebook password              # enter a password to protect the server



[C 16:27:06.426 NotebookApp] Bad config encountered during initialization:

[C 16:27:06.426 NotebookApp] The 'contents_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x7fece824ed50> instance must be a type, but 'notedown.NotedownContentsManager' could not be imported
Error

看到最后一行,貌似提示说没找到 notedown 模块,导致某个方法无法 import:

[C 16:27:06.426 NotebookApp] Bad config encountered during initialization:

[C 16:27:06.426 NotebookApp] The 'contents_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x7fece824ed50> instance must be a type, but 'notedown.NotedownContentsManager' could not be imported

我试着安装 notedown ,通过  conda list 确实没发现 notedown 字样的东西,于是:

conda install -c conda-forge notedown

最后再次运行  jupyter notebook  ,终端迅速列出一堆文字:

(demo) [iyl:~]$jupyter notebook
[I 18:26:34.356 NotebookApp] Serving notebooks from local directory: /Users/iyl
[I 18:26:34.356 NotebookApp] The Jupyter Notebook is running at:
[I 18:26:34.356 NotebookApp] http://localhost:8888/?token=cf1e93f5a51b0fa9239aff83f52431d96e7522f5de0715d8
[I 18:26:34.356 NotebookApp]  or http://127.0.0.1:8888/?token=cf1e93f5a51b0fa9239aff83f52431d96e7522f5de0715d8
[I 18:26:34.356 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:26:34.373 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///Users/iyl/Library/Jupyter/runtime/nbserver-6095-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=cf1e93f5a51b0fa9239aff83f52431d96e7522f5de0715d8
     or http://127.0.0.1:8888/?token=cf1e93f5a51b0fa9239aff83f52431d96e7522f5de0715d8

紧接着,浏览器弹出来了,进入了 notebook 界面:

至此,jupyter notebook 安装成功。

 

 

 

  • Add to Phrasebook
     
    • No word lists for Simplified Chinese -> Simplified Chinese...
       
    • Create a new word list...
  • Copy
  • Add to Phrasebook
     
    • ECoG
    • Create a new word list...
  • Copy
  • Add to Phrasebook
     
    • ECoG
    • Create a new word list...
  • Copy
  • Add to Phrasebook
     
    • No word lists for Simplified Chinese -> Simplified Chinese...
       
    • Create a new word list...
  • Copy
技术分享,督促学习。
原文地址:https://www.cnblogs.com/YLDream/p/12859411.html