jupyterlab是类似于matlab实时脚本的一种工具,将编程和文本管理放置在一个文件中,其中代码部分可以执行,注释部分可以阅读,代码执行结果可以预览,不同的地方在于 jupyter采用markdown进行注释管理,采用网页显示和编程,matlab在单机中运行。
jupyterlab官网:https://jupyter.org
- 简介
- 用来取代JupyterLab的一个基于Web的用户交互式用户界面。相当于增强版的Jupyter Notebook。
- 相较于Jupyter Notebook,在JupyterLab里除了建立传统的Jupyter笔记(Jupyter Notebook),还文本编辑器、终端(terminal)、方便易用的文件浏览器。
- 作为文本编辑器,除了编辑文本文件外,还可预览excel文件、csv文件、图片文件、json文件等。
- JupyterLab非常适合数据分析、教程编写等任务。
- 部署
1)系统环境almalinux8.5,安装必要依赖
yum install python3 python3-pip python3-setuptools screen -y python3 -m pip install --upgrade pip pip install jupyterlab jupyter lab password #设置密码
2)修改配置文件
rm -rf /root/.jupyter/jupyter_server_config.json cat <<EOF > /root/.jupyter/jupyter_server_config.json { "ServerApp": { "ip":"*" ,"port":8888 ,"open_browser":false ,"password": "argon2:$arg" } } EOF
3)配置防火墙
systemctl restart firewalld firewall-cmd --permanent --zone=public --add-port=8888/tcp systemctl restart firewalld
4)后台运行,采用screen
#后台运行 screen -S fanlog #nohup jupyter lab --allow-root > jupyter.log 2>&1 & jupyter-lab --allow-root #以管理员权限运行
5)安装中文语言包
pip install jupyterlab-language-pack-zh-CN
6)效果
http://ip:8888访问效果如下:
7)测试
jupyter在线版本提供测试代码
https://jupyter.org/try-jupyter/lab/
将其在本地部署中进行测试
from matplotlib import pyplot as plt import numpy as np # Generate 100 random data points along 3 dimensions x, y, scale = np.random.randn(3, 100) fig, ax = plt.subplots() # Map each onto a scatterplot we'll create with Matplotlib ax.scatter(x=x, y=y, c=scale, s=np.abs(scale)*500) ax.set(title="Some random data, created with JupyterLab!") plt.show()
需要事先安装matplotlib库
pip install matplotlib
本地运行效果
测试通过
- 小结
在浏览器中直接开发和编写python程序并测试,不需本地复杂的环境,简化了交付。对小白用户比较友好,其无需重复的下载python的各种包。
参考资料
- https://jupyter.org/install
- https://blog.csdn.net/qq_42598133/article/details/109528395
- https://blog.csdn.net/qq_42468646/article/details/117964089
- https://unclehuzi.github.io/2022/09/jupyter_notebook_on_server/
- https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html