Ubuntu Jupyter 安装及远程访问配置

本文档详细介绍了如何在Ubuntu操作系统中安装Jupyter,并配置远程访问。步骤包括安装Jupyter、生成配置文件、设置密码、修改配置文件以解决Python2的编码问题,以及最后通过输入IP地址和端口号进行远程使用。

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

安装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:端口号就可以用啦

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值