Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

部署jupyterlab—python网页编程工具[0]

Posted on 2023年11月14日2025年5月6日 by

jupyterlab是类似于matlab实时脚本的一种工具,将编程和文本管理放置在一个文件中,其中代码部分可以执行,注释部分可以阅读,代码执行结果可以预览,不同的地方在于 jupyter采用markdown进行注释管理,采用网页显示和编程,matlab在单机中运行。

jupyterlab官网:https://jupyter.org

  • 简介
  1. 用来取代JupyterLab的一个基于Web的用户交互式用户界面。相当于增强版的Jupyter Notebook。
  2. 相较于Jupyter Notebook,在JupyterLab里除了建立传统的Jupyter笔记(Jupyter Notebook),还文本编辑器、终端(terminal)、方便易用的文件浏览器。
  3. 作为文本编辑器,除了编辑文本文件外,还可预览excel文件、csv文件、图片文件、json文件等。
  4. 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的各种包。

 

参考资料

  1. https://jupyter.org/install
  2. https://blog.csdn.net/qq_42598133/article/details/109528395
  3. https://blog.csdn.net/qq_42468646/article/details/117964089
  4. https://unclehuzi.github.io/2022/09/jupyter_notebook_on_server/
  5. https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT