默认配置的情况下,无法启动Jupyter notebook,报错如下:
socket.gaierror: [Errno -2] Name or service not known
官方文档中的提到只需要更改~/.jupyter/jupyter_notebook_config.py文件中的c.NotebookApp.ip即可实现外部访问:
# Set ip to '*' to bind on all interfaces (ips) for the public server c.NotebookApp.ip = '*'
但在较新的版本的Jupyter(大概5.6.0以上)中,如果不做其他改动,便会报错。解决办法有两种:
-
将c.NotebookApp.ip改为0.0.0.0
-
打开远程访问权限,将c.NotebookApp.allow_remote_access改为True
相关链接: