菜鸟笔记
提升您的技术认知

JupyterServer配置

1. 安装jupyter

​pip install jupyter -i https://pypi.tuna.tsinghua.edu.cn/simple --default-timeout=1000

2. 生成配置

jupyter notebook --generate-config 

3. 修改配置,设置密码

获取密码的方式:命令行输入python后,用以下方式获取

from jupyter_server.auth import passwd
passwd('xxxx')

配置文件如下

# 打开文件编辑
vi /root/.jupyter/jupyter_notebook_config.py


# 编辑以下内容
c.NotebookApp.open_brower = False # 不需要在服务器上打开浏览器
c.NotebookApp.ip = '*' # 监听网络
c.ServerApp.notebook_dir = '/root'   # 指定目录
c.PasswordIdentityProvider.hashed_password = 'argon2:$argon2id$v=19$m=10240,t=10,p=xxxx' # 密码使用上面的方式获取
c.ServerApp.port = 8888  # 端口自己可以指定

4. 后台启动jupyter记入log 

nohup jupyter notebook >> jupyter-server.log 2>&1 &

 5. 远程访问

到此就配置好了。如果你的IP是192.168.1.1的话,你就可以在浏览器地址栏上输入192.168.1.1:8888进入Jupyter notebook了。