安装
- 新建虚拟环境Python虚拟环境virtualenvwrapper 安装配置 (可选)
mkvirtualenv jupyter -p python3
- Pip 安装
pip3 install jupyter
- 启动
jupyter notebook --no-browser --port 8888
配置远程访问
- 生成默认配置文件
# 配置文件path为 ~/.jupyter/jupyter_notebook_config_backup.py
jupyter notebook --generate-config
- 设置密码
jupyter notebook password
Enter password: #键入密码,不显示的
Verify password: #再次重复键入密码
# 密码写入到~/.jupyter/jupyter_notebook_config.json
ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: '************'
- 复制方法1文件中的password或者方法2的输出的密文字符串
- 编辑
~/.jupyter/jupyter_notebook_config_backup.py
加入
c.NotebookApp.ip = '*'
c.NotebookApp.password = u'***...刚才复制的那个密文'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888 #可自行指定一个端口, 访问时使用该端口
- 启动
- 后台启动,编写脚本~/cmd/jupyter.sh
cd /home/user_name
[python_path]/bin/jupyter notebook > jupyter.log 2>&1 &
alias jupyter="bash ~/cmd/jupyter.sh"
source ~/.bash_profile
jupyter
lsof -i:8888
kill -9 [pid]