Jupyter Notebook安装

208 阅读1分钟

Jupyter Notebook是python数据开发的重要工具。

环境

CentOS

系统: CentOS 7.7

Anaconda

下载并安装Anaconda

wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
bash Anaconda3-2021.05-Linux-x86_64.sh

win10

在系统环境变量PATH增加anaconda相关路径

  • D:\dev\anaconda
  • D:\dev\anaconda\Scripts
  • D:\dev\anaconda\Library\bin

设置conda

设置conda代理源,修改配置文件.condarc

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

清理conda缓存索引

conda clean -i

jupyter notebook

在安装Anaconda时已经安装完毕Jupyter notebook

生成基础配置文件,位置通常是~/.jupyter/jupyter_notebook_config.py

jupyter notebook --generate-config

生成登录密码,存于~/.jupyter/jupyter_notebook_config.json

jupyter notebook password

简单的配置配置文件

c.NotebookApp.ip='*'
c.NotebookApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$y7Iu/uoX4r3uDIAm+roeYQ$f6sT5FFYEhTe5rCHou96/Q'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888
c.NotebookApp.notebook_dir = '/usr/notebook'

启动notebook

nohup jupyter notebook &