在服务器开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
相关推荐
Ulyanov25 分钟前
刚体动力学方程——牛顿-欧拉与陀螺效应的奥秘
开发语言·python·目标跟踪·雷达电子对抗·导引头
观察员31 分钟前
用 Streamlit + 智谱 AI 打造虚拟伴侣聊天机器人
python
Cubar1 小时前
[一]开源ERP:odoo19二次开发问题-原库存模块问题
python·开源·odoo·开源erp
滴滴滴嘟嘟嘟.1 小时前
强化学习-PPO 奖励塑形实验:Pendulum-v1 中角速度惩罚权重的影响
开发语言·python
Sylvia33.2 小时前
足球数据接口开发实战:如何用火星数据API盘活赛事应用
java·服务器·开发语言·数据库·python
lupai2 小时前
身份证二要素实名认证 API 落地应用指南
python
cxr8282 小时前
大语言模型上下文缓存命中率测试全场景清单
人工智能·python·算法·缓存·语言模型·自然语言处理·llm
某林2122 小时前
大模型边缘部署到底层硬件闭环
python·架构·机器人·硬件架构·ros2
LadenKiller3 小时前
最新量化软件选择,先按能力判断表达生成和执行
人工智能·python
iuu_star3 小时前
Python大模型智能学习平台——设计与实现(AI教学系统)
大数据·人工智能·python·学习