自从搬家后,树莓派闲置了好一段时间,最近打算将其利用起来。想来想去,搭个jupyter notebook用要靠谱的,毕竟经常要实验一些Python脚本。

具体过程参考以下链接:

https://www.techcoil.com/blog/how-to-setup-jupyter-notebook-on-raspberry-pi-3-with-raspbian-stretch-lite-supervisor-and-virtualenv-to-run-python-3-codes/

教程中给出了在virtualenv中启动Python3版本的jupyter notebook server的方案,这样做的好处是可以方便地单独管理jupyter的包。在这个教程中,还发现了个人折腾启动服务的神器,supervisor,好评。

tips: 如果想要让jupyter同时支持Python2和Python3,安装对应的python2-ipykernel即可,此时Python2为/usr/bin/python2

最后附上,根据教程编写的自动化脚本:

# 安装supervisor和virtualenv
apt install supervisor python3-virtualenv -y
# 在virtualenv中安装jupyter
python3 -m virtualenv -p python3 /home/pi/jupyter-env
source /home/pi/jupyter-env/bin/activate
pip install jupyter
deactivate
# 在virtualenv环境中启动jupyter
mkdir /home/pi/jupyter-notebook
chmod 777 /home/pi/jupyter-notebook
# # 设置jupyter启动脚本
(
cat << EOF
#!/bin/bash
source /home/pi/jupyter-env/bin/activate
jupyter notebook --ip 0.0.0.0 --port 9999 --no-browser
deactivate
EOF
) > /home/pi/jupyter-notebook/run-jupyter-notebook.sh
sudo chmod +x /home/pi/jupyter-notebook/run-jupyter-notebook.sh
# supervisor配置
(
cat << EOF
#!/bin/bash
[program:jupyter-notebook]
directory=/home/pi/jupyter-notebook
command=/bin/bash -E -c ./run-jupyter-notebook.sh
autostart=true
autorestart=true
stopsignal=INT
stopasgroup=true
killasgroup=true
user=pi
EOF
) > /etc/supervisor/conf.d/jupyter-notebook.conf
# 重启supervisor以启动jupyter notebook
systemctl restart supervisor.service
sleep 5
# 输出用于登录验证的token
supervisorctl tail jupyter-notebook stdout

在树莓派上搭建jupyter notebook server的更多相关文章

  1. 在Linux服务器上运行Jupyter notebook server教程

    在Linux服务器上运行Jupyter notebook server教程 很多deep learning教程都推荐在jupyter notebook运行python代码,方便及时交互.但只在本地运行 ...

  2. vps上搭建jupyter notebook远程服务

    安装anaconda 使用如下命令下载: wget https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh 如果非roo ...

  3. 服务器上搭建jupyter notebook

    参考:https://zhuanlan.zhihu.com/p/44405596 https://blog.csdn.net/cvMat/article/details/79351420 遇到的问题 ...

  4. 搭建Jupyter Notebook服务器

    昨天发了Jupyter的使用,补一篇Jupyter服务器的搭建~ 一.搭建Jupyter 1.安装 使用virtualenv建虚拟环境.在虚拟环境中安装jupyter.matplotlib等等需要的库 ...

  5. 树莓派上搭建基于Python+web.py+fastcgi+lighttpd的网站

    最近在网上淘了一个树莓派,什么是树莓派?这里是他的官方网站你可以去看看. 简单的说就是一块使用了ARM11的CPU,具有256MB或512MB内存的具有两个USB接口,一个RJ45接口,HDMI输出和 ...

  6. Python - 搭建Jupyter notebook环境

    1- Jupyter简介 HomePage:https://jupyter.org/ 安装指南:https://jupyter.org/install.html 官方文档:https://jupyte ...

  7. 使用docker搭建jupyter notebook / jupyterlab

    说明 由于官方镜像实在是不怎么好用,所以我自己做了一个优化过的jupyter notebook的镜像 notebook_hub,使用我这个镜像搭建容器非常简单,下面就基于这个notebook_hub来 ...

  8. 使用centos linux vps搭建jupyter notebook踩坑日记

    今天我尝试用vps搭建在线jupyter notebook网站时遇到了这样一个问题: [W 21:48:07.243 NotebookApp] SSL Error on 9 ('171.115.101 ...

  9. 利用本地浏览器远程服务器上的jupyter notebook

    windows中访问远程服务器的方式有很多种:使用windows系统自带的网络功能,直接输入服务器地址访问:使用putty软件远程访问:使用xftp软件登陆:还可以使用x2go客户端图形界面远程访问. ...

随机推荐

  1. Linux中文件查找,压缩和打包指令

    1.文件的查找和搜索 可执行文件的搜索:which .whereis locate搜索文件 find搜索文件       1.1可执行文件的搜索       在Linux系统中,有成百上千个指令,不同 ...

  2. Apache 80跳转443

    <VirtualHost *:> ServerName your.domain.com #域名 RewriteEngine on #启用重定向 RewriteCond %{SERVER_P ...

  3. Gym-100814K 数位DP 模拟除法

    Johnny is a brilliant mathematics student. He loves mathematics since he was a child, now he is work ...

  4. Rsync实现负载均衡的数据同步

    使用三台服务器:系统:CentOS 6.8 192.168.8.169 开发服务器 192.168.8.167 线上服务器1192.168.8.168 线上服务器2 实现思路:在开发服务器上制定一个规 ...

  5. java数据结构--array与ArrayList的区别

    ArrayList 内部是由一个array 实现的. 如果你知道array 和 ArrayList 的相似点和不同点,就可以选择什么时候用array 或者使用ArrayList , array 提供 ...

  6. Vue结合webpack实现路由懒加载和分类打包

    https://blog.csdn.net/weixin_39205240/article/details/80742723

  7. awk-第一篇

    awk [单独的编程语言解释器] 1.awk介绍 全称:Aho Weinberger Kernaighan三个人的首字母缩写: 1970年第一次出现在Unix机器上,后来在开源领域使用它: 所以,我们 ...

  8. BZOJ 3162: 独钓寒江雪 树的同构 + 组合 + 计数

    Description Input   Output 求一棵树编号序列不同的方案数: 令 $f[u],g[u]$ 分别表示 $u$ 选/不选 的方案数. 则 $f[u]=\prod_{v\in son ...

  9. Mui去掉滚动条:

    /////////去掉滚动条mui.plusReady(function(){plus.webview.currentWebview().setStyle({scrollIndicator:'none ...

  10. 2019hdu多校 K-th Closest Distance

    题目链接:Click here 大致题意:q次询问,每次询问你区间[L,R]中|p-ai|的值第k小的是多少 Solution: 直接找是很困难的,我们考虑二分答案,那么本题就十分简单了 我们对权值维 ...