on ubuntu server install jupyter lab

一、安装jupyter lab

conda search jupyterlab

根据base的python版本,选择对应的版本

conda install jupyterlab==3.0.14

该方法优点是可以快速的启动JupyterLab,缺点是需要记住大量参数写法。以下是一些常见参数的说明:

  • --ip='*' 设置可访问的IP地址,*为所有
  • --port=8701设置服务端口为8701
  • --notebook-dir='/home/workspace' 设置工作目录路径为'/home/workspace'
  • --no-browser 不自动打开浏览器
  • --allow-root 允许root用户运行(若登陆的是root用户需要添加该命令)

jupyter lab --ip='*' --port=8701 --notebook-dir='/home/workspace' --no-browser --allow-root

3.2 修改配置文件参数运行

该方法优点是启动命令简洁,缺点是要准确的修改配置文件,下面对该方法进行介绍。

首先生成配置文件:

jupyter lab --generate-config

添加内容:

c = get_config()  #noqa

c.ServerApp.root_dir = '/home/workspace'

c.ServerApp.allow_remote_access = True

c.ServerApp.ip = '*'

c.LabApp.open_browser = False

c.ServerApp.port = 8701

c.ServerApp.iopub_data_rate_limit = 1.0e10

二、将python 环境安装到jupyter lab上

1.创建虚拟环境:conda create -n snp python=3.8.3

2. python -m ipykernel install --name snp

3.添加到Jupyter中:python -m ipykernel install --name snp #后面的环境名字需要更换

4.重启Jupyter,即可看到添加的虚拟环境

三、关闭服务

lsof -i:8701

kill -9 。。。

四、修改jupyter server 密码

 jupyter server password

/home/dzc/anaconda3/lib/python3.9/site-packages/jupyter_server/auth/security.py:172: UserWarning: Passwords do not match.
  hashed_password = passwd(password)
Enter password: 
Verify password: 
[JupyterPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_server_config.json

五、后台启动

nohup jupyter lab --allow-root &

 六、从客户端登录jupyter

① 浏览器方式:

http://10.255.132.22:8701/lab

②vs code 方式

 

输入ip地址和端口号,根据提示输入上面设置的密码

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值