开发者社区> 问答> 正文

运行 iPython notebook 报错:Cannot assign requested address

在 ubuntu 14.4 上安装了 Anaconda2,然后在命令行运行 ipython notebook 就报如下错误:

root@master:~# ipython notebook
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook`... continue in 5 sec. Press Ctrl-C to quit now.
Traceback (most recent call last):
  File "/root/anaconda2/bin/ipython", line 6, in <module>
    sys.exit(IPython.start_ipython())
  File "/root/anaconda2/lib/python2.7/site-packages/IPython/__init__.py", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/root/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 595, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-111>", line 2, in initialize
  File "/root/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/root/anaconda2/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 297, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/root/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/root/anaconda2/lib/python2.7/site-packages/IPython/core/application.py", line 401, in initialize
    self.parse_command_line(argv)
  File "/root/anaconda2/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 292, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<decorator-gen-4>", line 2, in parse_command_line
  File "/root/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/root/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 488, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "/root/anaconda2/lib/python2.7/site-packages/IPython/core/application.py", line 211, in initialize_subcommand
    return super(BaseIPythonApplication, self).initialize_subcommand(subc, argv)
  File "<decorator-gen-3>", line 2, in initialize_subcommand
  File "/root/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/root/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 426, in initialize_subcommand
    self.subapp.initialize(argv)
  File "<decorator-gen-115>", line 2, in initialize
  File "/root/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
    return method(app, *args, **kwargs)
  File "/root/anaconda2/lib/python2.7/site-packages/notebook/notebookapp.py", line 1023, in initialize
    self.init_webapp()
  File "/root/anaconda2/lib/python2.7/site-packages/notebook/notebookapp.py", line 887, in init_webapp
    self.http_server.listen(port, self.ip)
  File "/root/anaconda2/lib/python2.7/site-packages/tornado/tcpserver.py", line 126, in listen
    sockets = bind_sockets(port, address=address)
  File "/root/anaconda2/lib/python2.7/site-packages/tornado/netutil.py", line 196, in bind_sockets
    sock.bind(sockaddr)
  File "/root/anaconda2/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 99] Cannot assign requested address

网上好多建议修改 ipython_notebook_config.py,但还是不管用。折腾了五六个小时,还是没解决,太恼火了。

是不是阿里云服务器有什么网络限制?

展开
收起
幻大米 2016-05-04 16:22:35 22462 0
3 条回答
写回答
取消 提交回答
  • Re运行 iPython notebook 报错:Cannot assign requested address
    是不是不能使用公网IP?如何才能使用?
    2018-12-02 23:31:09
    赞同 展开评论 打赏
  • 回 1楼dongshan8的帖子
    太感谢版主了!!!!!!!!就是在 ipython notebook 后加上参数 --ip=127.0.0.1 就可以了!

    # ipython notebook --ip=127.0.0.1

    其实之前看过那个帖子,但一直以为那哥们说的 “And what if you try --ip=127.0.0.1? ” 是修改 ipython_notebook_config.py 文件,经版主提醒,才知道是参数!!

    菜鸟再次感谢版主指点!!!
    2016-05-04 19:41:54
    赞同 展开评论 打赏
  • 旺旺:nectar2。
    楼主您好,

    抱歉给您带来不便。

    这里的一个问答帖子提到,可以尝试在运行 ipython notebook 时指定绑定的IP地址。

    请参考: https://github.com/ipython/ipython/issues/6193
    2016-05-04 17:31:31
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Taking Jupyter Notebooks and Apache Spark to the Next Level with PixieDust 立即下载
Well-That-Escalated-Quickly-How-Abusing-The-Docker-API-Led-To-Remote-Code-Execution-Same-Origin-Bypass-And-Persistence 立即下载
低代码开发师(初级)实战教程 立即下载