Jupyterlab开发环境搭建

Catalogue
  1. jupyterlab开发环境搭建(支持gpu)
    1. 1. pip安装jupterlab
    2. 2. jupyterlab 启动
    3. 3. 使用脚本管理jupyter-lab
  2. 其它(废弃)

https://www.cnblogs.com/realwuxiong/p/14139194.html

jupyterlab开发环境搭建(支持gpu)

目标: 创建一个 jupyterlab. 包含以下环境

  1. 支持gpu环境.
  2. jupyterlab 支持python java语言.

1. pip安装jupterlab

1
2
3
4
5
6
# 1. 安装/更新
pip install --upgrade jupyterlab \
-i https://mirrors.aliyun.com/pypi/simple/

# 2. 查看版本
pip show jupyterlab

2. jupyterlab 启动

1
2
3
4
5
# 先调到python环境(python3.7;tensorflow2.11)(或者选择 ml2.7;tensorflow 1.4.0)
conda activate ml3.7

# 启动(重要)
cd /mnt/d/jupyter/quanoc && nohup jupyter-lab --ip 0.0.0.0 --no-browser --allow-root > jp_nohup.out 2>&1 &

python版本管理见:通过conda管理多个python版本

tensorflow 对应的cuda版本

3. 使用脚本管理jupyter-lab

脚本名称:start_jupyter.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

# Define the command to start Jupyter
start_jupyter() {
nohup jupyter-lab --ip 0.0.0.0 --no-browser --allow-root --notebook-dir=/home/quanoc > jp_nohup.out 2>&1 &
}

# Check if Jupyter process is running
if pgrep jupyter > /dev/null; then
echo "Jupyter is already running."
else
echo "Starting Jupyter..."
start_jupyter
fi

其它(废弃)

搭建 notebook

1
2
3
mkdir -p /mnt/d/jupyter/quanoc
mkdir -p /mnt/d/jupyter/quanoc/.jupyter
chmod 777 -R /mnt/d/jupyter/quanoc