通过在服务器上运行jupyter notebook,然后本地电脑连接,直接在本地电脑调试代码。
1. 准备工作
一台云服务器,服务器中已安装anaconda。
2. 搭建Jupyter notebbook环境
第一步:找到或生成配置文件jupyter_notebook_config.py,linux系统位置如下:
文件路径:/home/User/.jupyter/jupyter_notebook_config.py
如果上述位置没有这个文件,用下列命令生成:
jupyter notebook --generate-config
执行成功后,会出现下面信息:
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
第二步:修改生成的配置文件jupyter_notebook_config.py
修改配置文件:
vim jupyter_notebook_config.py
具体配置内容:
# 设置可以访问的ip, 默认是localhost, 将其改为 '*'
c.NotebookApp.ip = '*'
# 笔记本的默认打开目录, 自己选择设置的路径
c.NotebookApp.notebook_dir = '/home'
# 笔记本启动后是