在 Linux 服务器端安装配置 Jupyter,便于远程调试.
- 安装 Jupyter
sudo pip3 install jupyter - 生成 jupyter notebook 配置文件
jupyter notebook --generate-config - 生成密码密文(通过浏览器访问的时候需要输入该密码),运行 python3
>>> from notebook.auth import passwd >>> passwd() # 输入两次密码,然后就会生成秘钥 sha1:c04bd4ddd449:×××××××××××××××××××× - 编辑 jupyter notebook 配置文件 -
~/.jupyter/jupyter_notebook_config.py:
vim ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip = '*' # 设置所有 ip 皆可访问 c.NotebookApp.password = u'sha1:c04bd4ddd449:××××××××××××××××××××' # 生成的密码密文 c.NotebookApp.open_browser = False # 禁止自动打开浏览器 c.NotebookApp.port = 8088 # 指定端口 c.NotebookApp.allow_root = True c.ContentsManager.root_dir = '/home/ubuntu' - 服务器端运行命令 jupyter notebook
jupyter notebook 本地客户端浏览器访问 服务器IP:8088 即可.