尝试在CentOS 7上运行jupyter notebook
。它返回:
OSError: [Errno 99] Cannot assign requested address
堆栈跟踪:
[user@desktop ~]$ jupyter notebook
Traceback (most recent call last):
File "/home/use/anaconda3/bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/home/user/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/user/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/user/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/user/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1296, in initialize
self.init_webapp()
File "/home/user/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1120, in init_webapp
self.http_server.listen(port, self.ip)
File "/home/user/anaconda3/lib/python3.6/site-packages/tornado/tcpserver.py", line 142, in listen
sockets = bind_sockets(port, address=address)
File "/home/user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 197, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address
答案 0 :(得分:1)
在远程虚拟机中,我通过
解决了这个问题$ jupyter-notebook --ip=0.0.0.0 --port=8888
...
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://0.0.0.0:8888/?token=1234567890abcdefghijklmnopqrstuvwxyz (the token is for demo)
...
注意:不要分配具体的ip
然后我可以通过以下方式连接到 jupyter notebook:
http://your_vm_ip:8888/?token=1234567890abcdefghijklmnopqrstuvwxyz
(用 0.0.0.0
替换 your_vm_ip
)
答案 1 :(得分:0)
jupyter notebook --ip=127.0.0.1 --port=8888
我必须简单地设置ip / port params。问题可能是因为之前尝试分配的默认IP /端口已经被占用了!
答案 2 :(得分:0)
这是一个永久的解决方案。
jupyter notebook --generate-config
# c.NotebookApp.ip = 'localhost'
c.NotebookApp.ip = '127.0.0.1'
jupyter notebook
备注:有时需要先chmod授予权限,文件
答案 3 :(得分:0)
如果您已经尝试了多个端口(使用 --port XXXX
),但都没有工作:
检查 localhost
中的 /etc/hosts/
条目是否设置为除 127.0.0.1
以外的其他内容。