安裝的是Anaconda3(Python 3.6.4),自帶的版本較低,這里升級版本
conda update jupyterlab
一、配置jupyter lab(notebook)遠程訪問
1.1 生成一個 notebook 配置文件
默認情況下,配置文件 ~/.jupyter/jupyter_notebook_config.py 並不存在,需要自行創建。使用下列命令生成配置文件:
jupyter notebook --generate-config
1.2 生成密碼
從 jupyter notebook 5.0 版本開始,提供了一個命令來設置密碼:jupyter notebook password
,生成的密碼存儲在 jupyter_notebook_config.json
。
1.3 修改配置文件
在 jupyter_notebook_config.py
中找到下面的行,取消注釋並修改。
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888 #可自行指定一個端口, 訪問時使用該端口
二、后台運行
和其普通程序一樣,后台運行,並重定向log
nohup jupyter lab 2>&1 > ~/logs/jupyter.log &
三、添加目錄
jupyter labextension install @jupyterlab/toc
當然,大概率會出現這個錯誤,按提示安裝nodejs就行了
conda install nodejs
注:
在之前可以添加conda源,提高速度
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes