首先你的服务器要安装Python3,检查方法如下:
[root@cZEqhNpstj ~]# python -V Python 3.7.7 ## 如果出现Python3表示Python3已经安装成功 [root@cZEqhNpstj ~]# pip -V -bash: pip: command not found [root@cZEqhNpstj ~]# pip3 -V pip 20.3.3 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7) ## 如果出现pip版本表示pip安装成功
2. 安装JupyterLab3
## 安装python3 使用 pip3 install jupyterlab
3. 出现以下错误提示的解决方法
WARNING: The scripts jlpm, jupyter-lab, jupyter-labextension and jupyter-labhub are installed in '/usr/local/python3/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed jupyterlab-3.0.5
[root@cZEqhNpstj bin]# echo 'export PATH=/usr/local/python3/bin:$PATH' >>~/.bashrc [root@cZEqhNpstj bin]# source ~/.bashrc [root@cZEqhNpstj bin]# cd /
4. 生成密匙
ipyhon from jupyter_server.auth import passwd passwd() # 输入你的密码# 输入你的确认密码##生成密钥##保存好密钥 In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:48c2d4791549:7d9e7ac6a4411868a58c39fd0ec1c28037b6c04aDojone'
5. 生成jupyter lab 的配置文件
[root@cZEqhNpstj /]# jupyter lab --generate-config Writing default config to: /root/.jupyter/jupyter_lab_config.py
6. 修改配置文件
查找到响应的关键 进行 修改就可以了
如果 不是使用find 这里就教你一个快一点的查找方式
1. vi 打开文件以后 按 esc
2. 在按 : 冒号 效果图
3. 比如 要找一个 c.ServerApp.allow_remote_access 就可以使用
4.回车 就可以了, 就找到相对应的名字了,如果想查找下一个 回车之后按n键就可以找出有没有下一个了
5. 进行修改 在找到以后按 i 键进行编辑
#------------------------------------------------------------------------------ # ServerApp(JupyterApp) configuration #------------------------------------------------------------------------------ c.ServerApp.password = 'sha1: xxxxx' #由jupyter_server.auth生成的密码串 c.ServerApp.allow_remote_access = True
6. 修改完之后 按键 esc : wq 保存 回车 保存完毕
7. 启动Jupyter Lab
后台启动Jupyter Lab:
#nohup jupyter-lab & 也可以放在后台运行,从而可以关闭终端 #或者放在一个tmux的会话里面 jupyter lab # 如果提示权限不够 jupyter lab --allow-root