ubuntu 下安装jupyter

1. 更新软件列表

  sudo apt-get update

2. 安装pip

  sudo apt-get install -y python3-pip

3. 更新pip

  python3 -m pip install --upgrade pip 

4. 使用pip安装Jupyter

  pip install jupyter notebook

5 添加环境变量

  sudo vim /etc/profile

       添加如下代码

              export PATH=$PATH:~/.local/bin

       退出编辑

              source /etc/profile//执行配置

6. 创建Jupyter默认配置文件(记住生成文件的位置,后面要用到)

  jupyter notebook --generate-config 

7. 生成SHA1加密的密钥,保存密钥,如'sha1:XXXXXX'

   ipython
   from notebook.auth import passwd
   passwd()
  Out[2]: 'sha1:7e07e7fe86be:f5b3b8f2b30a1b0f7586b0ddf08b8dd836a9bf00'

  exit();

8 设置jupyter 文件

     sudo vim /home/ubuntu/.jupyter/jupyter_notebook_config.py

     添加下面的代码

    c.NotebookApp.allow_remote_access = True #允许远程连接
    c.NotebookApp.ip='0.0.0.0' # 设置所有ip皆可访问
    c.NotebookApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$4EIqux1hNfgkFuqoWiEnUQ$k/CAr9P2J4/5GlBcsXTnJA' #之前复制的密码
    c.NotebookApp.open_browser = False # 禁止自动打开浏览器
    c.NotebookApp.port =8888 #任意指定一个端口
    c.NotebookApp.notebook_dir ='/home/ubuntu/programes/'

9 启动  jupyter notebook

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

原文地址:https://www.cnblogs.com/lyxblogs/p/15473034.html