【发布时间】:2016-09-19 05:20:31
【问题描述】:
我使用的是 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
【问题讨论】:
-
在 8888 端口上运行的其他东西?检查使用
lsof | grep 8888 -
@Petesh 我更新了问题并将
lsof | grep 8888的结果放在底部。 -
抱歉,应该是
lsof -nP | grep 8888来确定已经绑定到端口 8888 的内容;但该文件表明端口8888上已经运行了一些东西 - 您应该将笔记本端口更改为其他端口 - 编辑笔记本的ipython_config.py以使用不同的端口 -
@Petesh 我在我的计算机中找到了两个
ipython_config.py文件,但没有找到修改端口的地方。我还得到了http_127.0.0.1_8888.localstorage的内容并将其添加到问题的底部。好像和我要自己检查的ipynb文件有关。 -
我应该删除
http_127.0.0.1_8888.localstorage吗?
标签: python sockets ipython-notebook jupyter-notebook