JupyterLab安装教程

JupyterLab安装教程

安装miniconda或Anaconda

下载安装包进行安装

安装jupyter

  1. 创建虚拟环境
conda create -n jupyter python==3.8
  1. 安装jupyter和jupyterlab
conda install jupyter jupyterlab

windows配置

  1. 生成配置文件,下面这行命令将输出jupyter_notebook_config.py及其所在地址
jupyter notebook --generate-config
  1. 打开上述生成的文件,默认是xxx/.jupyter/jupyter_notebook_config.py,修改以下内容:
c.NotebookApp.notebook_dir = '文件路径'

linux配置

  1. 使用ipython设置密码,输入密码,记录输出的秘钥,后面会用到
ipython
from notebook.auth import passwd
passwd()
  1. 生成配置文件,下面这行命令将输出jupyter_notebook_config.py及其所在地址
jupyter server --generate-config
  1. 打开上述生成的文件,默认是/root/.jupyter/jupyter_server_config.py,修改以下内容:
#让所有人都可以访问
c.ServerApp.ip = '*'
# 这里的密码填写上面生成的密钥
c.ServerApp.password = '使用ipython生成的秘钥' 
# 禁用自动浏览器打开jupyter
c.ServerApp.open_browser = False 
# jupyter lab服务器的端口
c.ServerApp.port = 8888 # 修改到可用的端口
# 允许远程访问 
c.ServerApp.allow_remote_access = True
# 工作根目录
c.ServerApp.root_dir = '/root' # 目标文件路径

启动JupyterLab

jupyter lab --allow-root