ubuntu 安装jupyter,并且设置远程访问

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6 
sudo apt-get update 
sudo apt-get install python3.6

sudo apt-get install python3-pip
sudo apt-get install python-pip

pip -V
pip3 -V

pip3 升级

sudo pip3 install --upgrade pip 

安装jupyter notebook

  1. 检查是否有安装jupyter notebook,终端输入jupyter notebook,如果报错就是没有啦,那么就要用下面命令安装。
$sudo pip install pyzmq
$sudo pip install tornado
$sudo pip install jinja2
$sudo pip install jsonschema
$sudo pip install jupyter
  1. 生成配置文件

jupyter notebook --generate-config
3. 生成密码(后续写配置文件、登录Jupyter notebook需要)
打开python终端

In [1]: from IPython.lib import passwd

In [2]: passwd()
Enter password: 
Verify password: 
Out[2]: 'sha1:0e422dfccef2:84cfbcbb3ef95872fb8e23be3999c123f862d856' 
  1. 修改默认配置文件
vim ~/.jupyter/jupyter_notebook_config.py 

在文件头添加

c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888 #随便指定一个端口
c.IPKernelApp.pylab = 'inline'
c.NotebookApp.allow_remote_access = True
  1. 启动jupyter notebook
jupyter notebook

若出现以下错误:
在这里插入图片描述

解决方法
在默认的配置文件中添加以下代码即可访问
c.NotebookApp.allow_remote_access = True

使用supervisor 对notebook进行管理

[program:notebook]
command=jupyter notebook --allow-root
directory=/home/ubuntu/notebook/
user=root
autostart=true
autorestart=true
redirect_stderr=True
stopasgroup=true
killasgroup=true
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值