运行'ipython notebook'获取[Errno 49]无法分配请求的地址

2024-06-10 12:25:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我在MacOS10.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

Tags: tolocalhosthttpdownloadsgooglelibrarychromereg
1条回答
网友
1楼 · 发布于 2024-06-10 12:25:03

感谢@Petesh,我现在可以温和地使用ipython笔记本,使用以下命令:

ipython notebook --ip=127.0.0.1

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

相关问题 更多 >