1.安装pip3
升级库列表
sudo apt-get update
查询是否有pip3的库,找到python3-pip
sudo apt-cache search pip
安装python3-pip
sudo apt-get install python3-pip
2.安装jupyterlab
sudo pip3 install jupyterlab
3.配置JupiterLab生成密码,网上多数说的是使用from notebook.auth import passwd生成密码,不对,请使用from jupyter_server.auth import passwd生成密码
pi@raspberrypi:~/pythonproj/jupyter_lab $ ipython
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.21.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from jupyter_server.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:8e218189c7c2:3526d8f943413ba0dfced32b569def971742a4f1'
In [3]: exit
pi@raspberrypi:~/pythonproj/jupyter_lab $
生成配置文件
pi@raspberrypi:~/pythonproj/jupyter_lab $ jupyter lab --generate-config
Writing default config to: /home/pi/.jupyter/jupyter_lab_config.py
pi@raspberrypi:~/pythonproj/jupyter_lab $ sudo vi /home/pi/.jupyter/jupyter_lab_config.py
修改后的内容如下:
pi@raspberrypi:~ $ grep -P "^[^#]" /home/pi/.jupyter/jupyter_lab_config.py
c.ServerApp.allow_remote_access = True
c.ServerApp.allow_root = True
c.ServerApp.ip = '*'
c.ServerApp.password = u'sha1:8e218189c7c2:3526d8f943413ba0dfced32b569def971742a4f1'
pi@raspberrypi:~ $
启动jupyter lab
jupyter-lab
浏览器输入:http://raspberrypi:8888/lab,即可打开jupyter