【问题标题】:jupyter notebook cannot run on Macjupyter notebook 无法在 Mac 上运行
【发布时间】:2017-02-01 03:46:08
【问题描述】:

pip 后安装 jupyter

$ jupyter notebook

我无法正确运行 jupyter-notebook。我得到的错误是:

Traceback (most recent call last): File "/usr/local/bin/jupyter-notebook", line 11, in <module> sys.exit(main()) File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs) File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance app.initialize(argv) File "<decorator-gen-7>", line 2, in initialize File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 1071, in initialize self.init_webapp() File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 919, in init_webapp self.http_server.listen(port, self.ip) File "/Library/Python/2.7/site-packages/tornado/tcpserver.py", line 126, in listen sockets = bind_sockets(port, address=address) File "/Library/Python/2.7/site-packages/tornado/netutil.py", line 153, in bind_sockets 0, flags)): socket.gaierror: [Errno 4] Non-recoverable failure in name resolution

【问题讨论】:

  • 你运行的是哪个版本的 jupyter notebook?
  • @rtk22 版本 4.2.0
  • 尝试jupyter notebook --ip=127.0.0.1,如果失败则jupyter notebook --ip=0.0.0.0
  • @rtk22 你是对的。我已经解决了这个问题。谢谢!
  • 如果这是您第一次,请尝试安装 Jupyter 附带的 Anaconda 包管理器。 continuum.io/downloads

标签: python macos python-2.7 jupyter


【解决方案1】:

检查 /etc/hosts 后,我删除了错误的 localhost 记录,但不知道是谁添加的。

之前:

127.0.0.1    localhost
255.255.255.255    broadcasthost
::1             localhost 
fe80::10    localhost

之后:

127.0.0.1    localhost
255.255.255.255    broadcasthost
::1             localhost 

现在 jupyter notebook 正在工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-04
    • 1970-01-01
    • 2018-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-12
    相关资源
    最近更新 更多