Linux安装 Jupyter Notebook 并配置任意IP密码访问

1 篇文章 0 订阅
1 篇文章 0 订阅

Linux安装 Jupyter Notebook 并配置任意IP密码访问

1. 下载安装包

https://www.anaconda.com/products/individual

在这里插入图片描述
我这里下载Linux 64位版本的
也可以在终端直接输入以下命令进行下载:

wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh

2. 安装

sh Anaconda3-2020.02-Linux-x86_64.sh

q回车

Welcome to Anaconda3 2020.02
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>

按Enter

Anaconda reserves all rights not expressly granted to you in this Agreement.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the followi
ng conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following dis

Do you accept the license terms? [yes|no]
[no] >>>

输入yes回车

Anaconda3 will now be installed into this location:
/home/jupyter/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

按Enter

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>>

输入yes回车
在终端输入以下两条命令

touch ~/.condarc
source ~/.bashrc

在命令行输入jupyter notebook 即可进入notebook
Ctrl + C停止运行

3. 配置

3.1 生成jupyter配置文件

jupyter notebook --generate-config --allow-root

此时会返回给我们配置文件的位置
Writing default config to: /home/jupyter/.jupyter/jupyter_notebook_config.py

3.1 生成哈希密码

$ ipython

Python 3.7.6 (default, Jan  8 2020, 19:59:22)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from notebook.auth import passwd

In [2]:passwd()
Enter password:
Verify password:
Out[2]: 'sha1:9b54xxxxd0d5:694b082faxxxc1862f969170f211xxx5b9xxxxee' 

得到一串哈希密码

3.3 修改配置文件

打开3.1中生成的这个配置文件

vi ~/.jupyter/jupyter_notebook_config.py
  • 修改密码
    找到#c.NotebookApp.password = ''
    去掉前面的#,在引号中输入刚才生成的哈希密码

  • 更改端口
    c.NotebookApp.port = 8888,端口改为8888

  • 任何IP可访问
    修改:#c.NotebookApp.ip = 'localhost'
    变为:c.NotebookApp.ip = '*'

ESC+:wq保存退出。

3.4 配置文件中的其他可配置选项

c.NotebookApp.notebook_dir ='' #配置jupyter文件夹的目录

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

会飞的果粒橙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值