我在Mac OS 10.10.4上。
当我从命令行运行ipython notebook时,它给我一个错误Cannot bind to localhost, using 127.0.0.1 as default ip [Errno 49] Can't assign requested address:

Yans-MacBook-Pro:/ yanyang$ ipython notebook
[W 01:32:12.908 NotebookApp] Cannot bind to localhost, using 127.0.0.1 as default ip
    [Errno 49] Can't assign requested address
[I 01:32:12.912 NotebookApp] Serving notebooks from local directory: /
[I 01:32:12.913 NotebookApp] 0 active kernels
[I 01:32:12.913 NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
[I 01:32:12.913 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

稍后将导致更多错误。我该如何解决?
localhost:~ yanyang$ lsof | grep 8888
Google      358 yanyang  txt      REG                1,4   16621568 26888859 /Users/yanyang/Library/Caches/Google/Chrome/Profile 5/Cache/data_4
Google      358 yanyang   90u     REG                1,4   16621568 26888859 /Users/yanyang/Library/Caches/Google/Chrome/Profile 5/Cache/data_4
Google      358 yanyang  205u     REG                1,4       3072 35352297 /Users/yanyang/Library/Application Support/Google/Chrome/Profile 5/Local Storage/http_127.0.0.1_8888.localstorage

上面代码块最后一行中文件的内容:
?????z!11?tableItemTableItemTableCREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)[!}1indexsqlite_aut?S???widgets:http://127.0.0.1:8888/notebooks/Downloads/PhillyCrime.ipynb{}?*?Qwidgets:http://127.0.0.1:8888/notebooks/Users/yanyang/Downloads/PhillyCrime.ipynb{}
??X?
    ?widgets:http://127.0.0.1:8888/notebooks/Downloads/PhillyCrime.ipynb?&?Q    widgets:http://127.0.0.1:8888/notebooks/Users/yanyang/Downloads/PhillyCrime.ipynb

最佳答案

感谢@Petesh,现在可以使用以下命令温和地使用ipython Notebook:

ipython notebook --ip=127.0.0.1

对于进一步的解决方案,我发现在Mac的“/etc/hosts”中,没有将127.0.0.1设置为localhost。那是最终的解决方案。

关于python - 运行 'ipython notebook'会得到[Errno 49]无法分配请求的地址,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35117031/

10-13 06:33