在服务器开jupyter notebook server

参考

1、安装notebook

bash 复制代码
pip install notebook

2、生成配置文件

bash 复制代码
jupyter notebook --generate-config

生成的配置文件,在linux下的路径一般是"/home/USERNAME/.jupyter/jupyter_notebook_config.py"

3、配置密码

bash 复制代码
jupyter notebook password

Enter password:  ****
Verify password: ****
[NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json

4、编辑配置文件

bash 复制代码
vim ~/.jupyter/jupyter_notebook_config.py


# 在 jupyter_notebook_config.py 文件中添加以下配置
# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 8888
c.NotebookApp.notebook_dir = '/root/jupyter_projects' #这里是设置Jupyter的根目录
c.NotebookApp.allow_root = True # 为了安全,Jupyter默认不允许以root权限启动jupyter

5、启动notebook后台运行

bash 复制代码
nohup jupyter notebook --port=12345 --no-browser > logs/jupyter_notebook.log 2>&1 &

上面的指令也可以添加上 --allow-root

6、在本地浏览器访问

在浏览器中输入 http://ip:12345

7、查看端口是不是被占用

bash 复制代码
# 查看端口12345是不是被其他进程占用了
netstat -lnp | grep 12345

# 也可以用下面的方式查看 端口12345 是不是被占用了
ps -ef | grep 12345
相关推荐
数字融合28 分钟前
透明化视频驱动化工生产动态三维重建管控技术
大数据·人工智能·python
屿华AI1 小时前
AUTOSAR 实战-诊断工具 | DTC/Event/FiM 故障报告自动化:DEM 诊断数据采集与解析
python·测试工具·自动化·汽车
贝壳6901 小时前
9.13.12 那三个新功能,我一个一个跑了一遍:两个真香,一个有前提
python
2601_967980111 小时前
Python 与云计算:AWS、GCP、Azure 实践
python·云计算·azure·aws·gcp
屿华AI2 小时前
AUTOSAR 实战-诊断工具 | 基于 Python 与 USB-CANFD 的 UDS 诊断测试工具设计与实现
开发语言·python·测试工具
贝壳6902 小时前
三家 AI 把我的实测数据判成造假,我在同一台机器上重跑了五组
python
用户019027581612 小时前
Telegram Bot 股票到价提醒:AlphaFeed 轮询 + sendMessage
python
黑客笔记3 小时前
Python 进程池和线程池:用等待任务理解并发
开发语言·python
卷无止境3 小时前
Python 开发中的资源管理:统一生命周期,保留资源差异
后端·python
新*4 小时前
520 万数据迁移实战:Elasticsearch 索引重建与"改名"的完整踩坑记录
python·mysql·elasticsearch·数据迁移