0
点赞
收藏
分享

微信扫一扫

树莓派4B 8G安装日志(3)——编程环境

卿卿如梦 2022-04-20 阅读 50
python

一、jupyter工具环境

在树莓派上安装jupyter会比较方便远程使用web进行python代码的调试。使用时,只需打开树莓派,然后在树莓派终端上输入"jupyter notebook"就可以在外部的机器或者pad上用web浏览器通过输入树莓派的ip:8888(端口)访问树莓派的jupyter服务了。

(一)、 安装jupyter

  1. 安装指令:sudo pip install jupyter
  2. 生成配置文件:jupyter notebook --generate-config
  3. 修改此配置文件: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/' // 可以访问的目录
  1. 设置jupyter notebook的访问密码:jupyter notebook password
  2. 启动jupyter notebook:jupyter notebook
  3. 远程打开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,设置完毕。

举报

相关推荐

0 条评论