赞
踩
创建Python虚拟环境
$ mkvirtualenv jupyterlab
安装jupyterlab
$ workon jupyterlab
(jupyterlab) $ pip3 install jupyterlab
生成jupyterlab配置文件
(jupyterlab) $ jupyter lab --generate-config
修改jupyterlab配置文件:
(jupyterlab) $ vim jupyter_lab_config.py
允许任意IP地址访问。
## The IP address the Jupyter server will listen on.
# Default: 'localhost'
c.ServerApp.ip = '0.0.0.0'
启动jupyterlab时,不打开浏览器。
## Whether to open in a browser after starting.
# The specific browser used is platform dependent and
# determined by the python standard library `webbrowser`
# module, unless it is overridden using the --browser
# (ServerApp.browser) configuration option.
# Default: False
c.ServerApp.open_browser = False
设置jupyterlab密码
(jupyterlab) $ jupyter lab password
Enter password:
Verify password:
[JupyterPasswordApp] Wrote hashed password to /home/jing/.jupyter/jupyter_server_config.json
防火墙打开端口
# 查询8888端口是否打开 (jupyterlab) $ sudo firewall-cmd --query-port=8888/tcp no # 将8888端口开放 (jupyterlab) $ sudo firewall-cmd --add-port=8888/tcp --permanent success # 重新载入配置 (jupyterlab) $ sudo firewall-cmd --reload success # 查询8888端口是否打开 (jupyterlab) $ sudo firewall-cmd --query-port=8888/tcp yes
启动jupyterlab
(jupyterlab) $ jupyter lab
[I 2022-10-24 14:39:28.903 ServerApp] jupyterlab | extension was successfully linked.
[I 2022-10-24 14:39:28.911 ServerApp] nbclassic | extension was successfully linked.
[I 2022-10-24 14:39:29.123 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-10-24 14:39:29.144 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-10-24 14:39:29.144 ServerApp] Jupyter Server 1.21.0 is running at:
[I 2022-10-24 14:39:29.144 ServerApp] http://192.168.110.228:8888/lab
[I 2022-10-24 14:39:29.144 ServerApp] or http://127.0.0.1:8888/lab
[I 2022-10-24 14:39:29.144 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
访问jupyterlab
在浏览器中输入http://服务器IP地址:8888/lab。
访问成功之后,在需要输入密码进入jupyterlab。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。