安装Jupyter Notebook

本来还想安装Java内核的,结果失败了,哎。

起因

闲来无事,装个Jupyter notebook。

  • 安装anaconda3

    wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
    sh Anaconda3-2021.11-Linux-x86_64.sh
    
  • 切换用户后conda install jupyter

    不行。

    遂:

    pip3 install jupyter
    
    jupyter notebook --generate-config
    
    vim /home/user/.jupyter/jupyter_notebook_config.py
    
  • 添加如下配置:

    # 设置可以访问的ip, 默认是localhost, 将其改为 '*'
    c.NotebookApp.ip = '*'
    
    # 笔记本的默认打开目录, 自己设置
    c.NotebookApp.notebook_dir = '/home/jupyter/documents/jupyter_notebook'
    
    # 笔记本启动后是否打开浏览器, 设为 False即可
    c.NotebookApp.open_browser = False
    
    # 默认访问端口, 可自己修改
    c.NotebookApp.port = 8888
    
    # jupyterlab是否显示quit按钮,我设为false以免自己不小心按到把服务停了
    c.NotebookApp.quit_button = False
    
    # 如果使用root用户运行,将下列值改为True即可, 运行时也可加参数将其改为True
    c.NotebookApp.allow_root = False
    

完成