一、jupyter工具环境
在树莓派上安装jupyter会比较方便远程使用web进行python代码的调试。使用时,只需打开树莓派,然后在树莓派终端上输入"jupyter notebook"就可以在外部的机器或者pad上用web浏览器通过输入树莓派的ip:8888(端口)访问树莓派的jupyter服务了。
(一)、 安装jupyter
- 安装指令:
sudo pip install jupyter - 生成配置文件:
jupyter notebook --generate-config - 修改此配置文件:
sudo gedit ~/.jupyter/jupyter_notebook_config.py,将下面的文件修改为对应的值,或者对原文不修改,直接将下面的代码加到源文件末端。但是特别要注意的是 “所有代码前面不要加空格”
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888 // 开放的端口号
c.NotebookApp.notebook_dir = '/home/pi/' // 可以访问的目录
- 设置jupyter notebook的访问密码:
jupyter notebook password - 启动jupyter notebook:jupyter notebook
- 远程打开web浏览器,输入树莓派的IP和端口,例如“http://192.168.1.200:8888”,会要求输入登录密码,就将步骤4当中设置的密码填入登录就可以了。
(二)、配置jupyter
1、安装代码补全工具
现在的jupyter notebook还没有代码补全工具,如下操作安装:
关闭jupyter notebook服务,逐次运行:
pip install jupyter_nbextensions_configurator -i https://pypi.doubanio.com/simple
pip install jupyter_contrib_nbextensions -i https://pypi.doubanio.com/simple
jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user
都没有报错之后,启动服务:jupyter notebook
在远程web上打开jupyter:http://192.168.1.200:8888
会看到如下场景,多出Nbextensions这个东西:

点击Nbextensions栏目,去掉左上角disable configuration for nbextensions 这一栏的√,找到Hinterland打上勾。

新建一个文件

测试一下代码补全:

ok,设置完毕。

本文介绍了如何在树莓派上安装和配置Jupyter Notebook,以便进行远程web调试,并安装代码补全工具提高开发效率。首先,通过sudo pip install jupyter命令安装Jupyter,然后配置其IP地址、端口和访问目录,设置访问密码。接着,安装jupyter_nbextensions_configurator和jupyter_contrib_nbextensions,启用代码补全功能,特别是Hinterland插件。最后,测试代码补全功能,完成配置。
——编程环境&spm=1001.2101.3001.5002&articleId=124288046&d=1&t=3&u=3455f0402a5e40dd95b6488c6883a5a4)
2万+

被折叠的 条评论
为什么被折叠?



