Ubuntu Jupyter 安装及远程访问配置

安装jupyter

pip install --upgrade pip
pip install jupyter

远程访问配置

生成配置文件

~$ jupyter notebook --generate-config 
Writing default config to: /home/yq/.jupyter/jupyter_notebook_config.py

生成密码

~$ ipython
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.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:117e0cc9673e:5ca67b637e0e2180027d36f8830c5711b7cf8e2f'

修改配置文件

vi .jupyter/jupyter_notebook_config.py 
# coding=UTF-8
c = get_config()
# Kernel config
c.NotebookApp.ip = '*'  # 就是设置所有ip皆可访问,在144行
c.NotebookApp.open_browser = False  # 禁止自动打开浏览器
# 密钥,在194行。该密钥就是2.1步生成的
c.NotebookApp.password = 'sha1:117e0cc9673e:5ca67b637e0e2180027d36f8830c5711b7cf8e2f'
c.NotebookApp.port = 8888  # 访问端口,在197行
c.NotebookApp.allow_remote_access = True

注意!!!!!!# coding=UTF-8 这句很重要!!!不然python2的话,会出现编码问题的!!!

使用jupyter

jupyter notebook

在浏览器中输入IP:端口号就可以用啦

你可能感兴趣的:(Python)