首先需要在服务器上安装jupyter notebook
1.创建虚拟环境
conda create -n env_name(环境名称) python=3.8(指定环境的python版本)
2.激活环境
conda activate env_name
3.安装jupyter
pip install Jupyter
pip install ipykernel
4.生成配置文件
jupyter notebook --generate-config
5.设置密码
jupyter notebook password
6.打开配置文件,修改配置(文件路径一般在 /home/用户目录/.jupyter/jupyter_notebook_config.py)
vim jupyter_notebook_config.py
温馨提示:linux编辑文件的操作:按一下esc,按一下i,进入插入模式,可以开始编辑文件。写完按一下esc,输入 :wq 即可退编辑,关闭文件
c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False
c.NotebookApp.ip = '*'
c.NotebookApp.allow_root = True
c.NotebookApp.port = 8888
7.服务器上启动jupyter
jupyter-notebook
8.本地连接服务器(cmd内)
ssh -L:9999:localhost:8888 username(用户名)@sever_ip(服务器IP)
9.本地使用
浏览器打开127.0.0.1:8888
输入刚才设置的密码,可以开始使用!