版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhao__zhen/article/details/83279705
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
- 检查是否有安装jupyter notebook,终端输入jupyter notebook,如果报错就是没有啦,那么就要用下面命令安装。
$sudo pip install pyzmq
$sudo pip install tornado
$sudo pip install jinja2
$sudo pip install jsonschema
$sudo pip install jupyter
- 生成配置文件
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'
- 修改默认配置文件
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
- 启动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