如何接受来自其他计算机的ipython连接? [英] How to accept connections for ipython from other computers?
问题描述
我在Ubuntu 12.04上运行ipython 0.12.1。您可以在浏览器中使用笔记本界面运行它:
I run ipython 0.12.1 on Ubuntu 12.04. You can run it in browser using notebook interface by running:
ipython notebook --pylab
配置文件可以在〜/ .config / ipython / profile_default /
中找到。看来每个内核的连接参数放在〜/ .config / ipython / profile_default / security / kernel-4e424cf4-ba44-441a-824c-c6bce727e585.json
。这是此文件的内容(新文件是在您启动新内核时创建的):
Configuration files can be found in ~/.config/ipython/profile_default/
. It seems that connection parameters for every kernel is placed in ~/.config/ipython/profile_default/security/kernel-4e424cf4-ba44-441a-824c-c6bce727e585.json
. Here is the content of this file (new files are created as you start new kernels):
{
"stdin_port": 54204,
"ip": "127.0.0.1",
"hb_port": 58090,
"key": "2a105dd9-26c5-40c6-901f-a72254d59876",
"shell_port": 52155,
"iopub_port": 42228
}
这是很自我解释,但我怎么设置一个服务器,将有一个永久的配置,所以我可以使用笔记本接口从其他计算机在局域网中。
It's rather self-explanatory but how can I set a server that would have a permanent configuration, so I can use notebook interface from other computers in the LAN?
推荐答案
Notebook服务器默认侦听localhost。如果你想让你的LAN上的所有机器可见,只需指示它在所有接口上侦听:
The Notebook server listens on localhost by default. If you want it to be visible to all machines on your LAN, simply instruct it to listen on all interfaces:
ipython notebook --ip='*'
或其他机器可见的特定IP:
Or a specific IP visible to other machines:
ipython notebook --ip=192.168.0.123
b $ b
根据您的环境,可能最好启用HTTPS和密码。
如果你计划公开服务,那么建立一个IPython配置文件也是个好主意(例如 ipython profile create nbserver
)并相应地编辑配置,所以你需要做的是:
If you plan on serving publicly a lot, then it's a also good idea to create an IPython profile (e.g. ipython profile create nbserver
) and edit the config accordingly, so all you need to do is:
ipython notebook --profile nbserver
加载所有ip / port / ssl / password设置。
To load all your ip/port/ssl/password settings.
这篇关于如何接受来自其他计算机的ipython连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!