Jupyter Notebook简明指南

1. 安装

python 3(推荐)

python3 -m pip install --upgrade pip
python3 -m pip install jupyter

python 2

python -m pip install --upgrade pip
python -m pip install jupyter

virtual environment

pip install --upgrade pip
pip install jupyter

2. 运行

2.1 基本运行命令

点击这里,查看官方指南。

2.2 在服务器上运行

设定为服务器的IP地址,并指定端口号

jupyter notebook --ip xxx.xxx.xxx.xxx --port xxxx

例如,服务器使用的IP为 172.16.2.233,指定端口号为 8888

jupyter notebook --ip 172.16.2.233 --port 8888

    
    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://172.16.2.233:8888/?token=277edfd3b1dd827a4641b0901f4b6eecedb0e861729a620d

2.3 设置默认配置

2.3.1生成配置文件
jupyter notebook --generate-config

配置文件路径为:
~/.jupyter/jupyter_notebook_config.py

2.3.2 生成密钥

代开 python shell

from notebook.auth import passwd
passwd()
Enter password: 
Verify password: 
'sha1:feb73cb5561d:ebb2959943c9392da717ee22934da7514f3a441d'
************
2.3.3 修改配置文件
vim ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='*'                     # 设置所有ip皆可访问,或者服务器IP地址
c.NotebookApp.password = u'sha1:feb73cb5561d:ebb2959943c9392da717ee22934da7514f3a441d'       # 刚才复制的那个密文'
c.NotebookApp.open_browser = False       # 禁止自动打开浏览器
c.NotebookApp.port = 8888                 # 指定端口

猜你喜欢

转载自blog.csdn.net/RadiantJeral/article/details/84028644