安装科学计算库anaconda并配置远程访问jupyter-notebook

本文介绍了如何在Debian 8.5上安装并配置Jupyter Notebook,使其能够支持远程访问。具体步骤包括安装Anaconda、配置Jupyter密码保护及调整相关设置等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近为了练习Kaggle上的一篇数据分析案例“泰坦尼克乘客获取概率预测”,在windows上的jupyter notebook中各种报错(可能是依赖关系没配好),于是萌发了在现有开发测试debian8.5虚拟机上搭建anaconda2的想法。
 

1. Installing Jupyter Notebook 
官网(https://jupyter.readthedocs.io/en/latest/install.html)建议使用Anaconda

1.1. 安装anaconda

wget下载,然后如下安装

bash Anaconda-latest-Linux-x86_64.sh

默认安装目录为用户家目录下的anaconda2,如:/home/omm/anaconda2

安装完成后就能执行jupyter notebook命令了,

列出anaconda当前包含哪些包:

conda -list

 #我采用的是full安装,所有该命令将会显示206个包,

而此时ssh连接到虚拟机上执行jupyter notebook命令的话,jupyter服务默认监听本地8888端口(启动后默认打开命令行下的web浏览器),远端却无法浏览器连接到虚拟机的jupyter服务

 

2. 配置jupyter notebook 实现远程访问

2.1 生成jupyter配置文件

jupyter notebook --generate-config

2.2 配置访问jupyter密码保护

$ ipython
Python 2.7.13 |Anaconda 4.3.1 (64-bit)| (default, Dec 20 2016, 23:09:15) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from notebook.auth import passwd

In [2]: passwd()
Enter password: 
Verify password: 
Out[2]: 'sha1:28ebb93ec41b:96830638e989cde7191b..................'

2.3 修改jupyter配置文件

$vim ~/.jupyter/jupyter_notebook_config.py

主要修改如下几个参数:

c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha1:ce...粘贴上一步生成的密文'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888

2.4 启动jupyter

jupyter notebook

启动信息如下:

omm@debiansible:~$ jupyter notebook
[W 20:46:24.481 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 20:46:24.488 NotebookApp] Serving notebooks from local directory: /home/omm
[I 20:46:24.488 NotebookApp] 0 active kernels 
[I 20:46:24.489 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/
[I 20:46:24.489 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

2.5 远程访问

访问地址http://ip:8888,输入2.2节配置的密码即可登录

 

转载于:https://my.oschina.net/u/614290/blog/873054

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值