在服务器开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
相关推荐
困死,根本不会17 小时前
蓝桥杯python备赛笔记之(八)动态规划(DP)
笔记·python·学习·算法·蓝桥杯·动态规划
weixin1997010801617 小时前
货铺头商品详情页前端性能优化实战
java·前端·python
深蓝电商API17 小时前
爬虫监控告警:结合企业微信或钉钉,打造 7×24 小时实时预警系统
爬虫·python·钉钉·企业微信
懷淰メ17 小时前
python3GUI--socket+PyQt5开发局域网微信(含功能、详细介绍、分享)
python·学习·gui·大学生·pyqt5·微信界面
risc12345617 小时前
channel.read(dest, channelPosition) 的读取大小限制
开发语言·python
xixixi7777718 小时前
拥抱AI大模型时代:开发者如何利用智能编程工具提升效率
人工智能·python·ai·大模型·aigc·代码
李昊哲小课18 小时前
Python 高级数据结构
开发语言·数据结构·python
小蜗牛~向前冲18 小时前
大模型学习系列-Embedding与向量数据库
人工智能·python·神经网络·学习·机器学习·embedding
MediaTea18 小时前
Python:词频统计流程及综合示例
开发语言·python
鲜于言悠90518 小时前
博客系统测试报告
python·功能测试·selenium·jmeter·测试用例·集成测试·pytest