Python Jupyter

wangzf 2022-07-13

Install Jupyter

Jupyter 相关库:

  • jupyter
  • notebook
  • jupyterlab
  • ipykernel
  • jupyter-client
  • jupyter-console
  • jupyter-core
  • jupyter-server
  • jupyterlab-pygments
  • jupyterlab-server
  • voila

安装 Jupyter 相关库

  • Jupyter
$ pip install jupyter
  • Jupyter Notebook
$ pip install notebook
  • Jupyter Lab
$ pip install jupyterlab
  • Voila(可选)
$ pip install voila

Jupyter kernel 设置

  • 安装 ipykernel 在当前环境:
$ pip instll ipykernel
  • 查看 kernel
$ jupyter kernelspec list
  • 将环境加入 Jupyter Lab
$ conda activate env_name
$ python -m ipykernel install --prefix=/Users/zfwang/Applications/miniconda3/envs/env_name/ --name env_name
$ ipykernel install --name env_name --user
  • 删除 kernel
$ jupyter kernelspec remove python3

JupyterLab 1.0

  • JupyterLab 帮助
$ jupyter lab -h
  • 登录 JupyterLab
    • --port
      • 指定端口号
    • --ip
      • 指定 IP
    • --notebook
$ jupyter lab --port="8080" --ip="*" --notebook-dir="/path/..."
  • 配置 JupyterLab 密码
$ jupyter lab --generate-config
$ jupyter lab password
  • 可以使用 --port 参数指定端口号
    • 部分云服务(如GCP)的实例默认不开放大多数网络端口,如果使用