尝试在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
4条答案
按热度按时间6rqinv9w1#
我不得不简单地设置IP/端口参数。这个问题很可能是因为它以前试图分配的默认IP/端口已经被占用了!
qnyhuwrf2#
在远程虚拟机中,我通过以下方法解决了该问题
注意:不要指定特定的ip
然后我可以通过以下方式连接到Jupyter笔记本电脑:
(将
0.0.0.0
替换为your_vm_ip
)1tuwyuhd3#
这里有一个永久的解决办法。
1.为Jupyter创建一个配置文件,在终端中输入:
jupyter notebook --generate-config
1.最后一个命令将在**/home/USER/.jupyter/jupyter_notebook_config.py中创建文件
1.打开文件jupyter_notebook_config.py并编辑变量c.NotebookApp.ip**,如下所示:
# c.NotebookApp.ip = 'localhost'
个c.NotebookApp.ip = '127.0.0.1'
1.在终端中输入:
jupyter notebook
备注:有时需要先chmod才能授予权限,文件
2ic8powd4#
如果您已经尝试了几个端口(使用
--port XXXX
),但都不起作用:检查
/etc/hosts/
中的localhost
条目是否未设置为127.0.0.1
以外的值。