conda 安装 jupyter lab

jupyterlab安装

python3.x(如果你有conda环境,当然也可以使用conda安装啦)
执行命令:

# conda 安装方式
conda install jupyterlab
# python 安装方式
pip install jupyterlab

等待安装完成之后,配置远程登录以及密码登录
进入到python环境,执行一下命令

nano@nano:~$ python3
Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from jupyter_server.auth import passwd
>>> passwd()
Enter password:
Verify password:
'sha1:2ba1cfd96ec3:abedd88f3701f0d6f80f2fa6142bc2a2b1dc461b'

在passwd()后输入密码,该密码以加密的形式展示,但是在登录jupyterlab页面的时候输入的还是原始的密码。

使用jupyterlab生成配置文件:

jupyter lab --generate-config

可以看到生成文件~/.jupyter/jupyter_lab_config.py

编辑文件,修改一下配置:

# 将ip设置为*,意味允许任何IP访问
c.ServerApp.ip = '*'
# 这里的密码就是上边我们生成的那一串
c.NotebookApp.password = 'sha1:2ba1cfd96ec3:abedd88f3701f0d6f80f2fa6142bc2a2b1dc461b'
# 服务器上并没有浏览器可以供Jupyter打开
c.ServerApp.open_browser = False
# 监听端口设置为8888或其他自己喜欢的端口
c.ServerApp.port = 8888
# 允许远程访问
c.Server.allow_remote_access = True

配置完成就可以启动啦,启动方式如下:

jupyter lab

# 后台启动:(该方式会在当前目录生成一个nohup.out的文件,记录日志)
nohup jupyter lab &

jupyterlab使用

启动完jupyterlab就可以通过web访问了,在启动的时候需要注意运行启动命令的目录,jupyter会将该目录作为根目录。

启动完之后界面是这样子的:
conda 安装 jupyter lab_第1张图片
那么在此界面,直接点击右边目录中的文件就可以进行编辑了,当然我觉得最方便的还是可以直接在web运行终端以及编写markdown文件了。
conda 安装 jupyter lab_第2张图片

你可能感兴趣的:(python,机器学习,jupyter,python,ide)