更改Jupyter Notebook的localhost:8888默认服务器与其他

Shu*_*gne 4 jupyter jupyter-notebook jupyter-console

我有两台通过局域网连接的机器.其他系统的IP地址是192.1xx.xx我想在我的机器上运行jupyter ipython查询,这可以在他的机器上执行.在ipython笔记本的开头,有一个黑屏,其中包含:

[I 11:12:52.802 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
Run Code Online (Sandbox Code Playgroud)

我可以将其更改为我指定的位置吗?

Gus*_*rra 9

您可以指定您希望Jupyter运行的端口取消注释/编辑以下行~/.jupyter/jupyter_notebook_config.py:

#c.NotebookApp.port = 8888
Run Code Online (Sandbox Code Playgroud)

如果您没有jupyter_notebook_config.py尝试运行jupyter notebook --generate-config.见对Jupyter配置的进一步细节.

如果您在远程计算机上访问Jupyter,您也可以尝试让Jupyter在其默认端口运行,并在您想要的端口上建立到本地计算机的SSH隧道,例如:

ssh -fNL <new port>:localhost:8888 <your ssh config>
Run Code Online (Sandbox Code Playgroud)


小智 7

运行 Anaconda Prompt,生成配置文件,如果您没有,请编辑配置文件并将 c.NotebookApp.ip 更改为您的 IP 地址“192.1xx.xx”

在 Anaconda Prompt 上:如果文件不存在,生成一个配置文件:

    jupyter notebook --generate-config
Run Code Online (Sandbox Code Playgroud)

输出:

    (base) C:\Users\youruser>jupyter notebook --generate-config
    Writing default config to: C:\Users\youruser\.jupyter\jupyter_notebook_config.py
    (base) C:\Users\youruser>
Run Code Online (Sandbox Code Playgroud)

切换到 jupyter 目录:

    cd .jupyter
Run Code Online (Sandbox Code Playgroud)

修改配置文件:

    ## The IP address the notebook server will listen on.
    #c.NotebookApp.ip = 'localhost'
Run Code Online (Sandbox Code Playgroud)

到:

    ## The IP address the notebook server will listen on.
    c.NotebookApp.ip = '192.1xx.x.x'
Run Code Online (Sandbox Code Playgroud)


cyb*_*onk 5

首先,您需要输入以下内容来生成配置文件:

$> jupyter notebook --generate-config
Writing default config to: /{home-directory}/.jupyter/jupyter_notebook_config.py
Run Code Online (Sandbox Code Playgroud)

接下来,您需要编辑该配置以更改端口号:

vi /{home-directory}/.jupyter/jupyter_notebook_config.py
Run Code Online (Sandbox Code Playgroud)

查找以下行(默认情况下已注释掉)并在该行中注释并更改端口号:

(default configuration)
## The port the notebook server will listen on.
# c.NotebookApp.port = 8888

(comment removed, port changed)
## The port the notebook server will listen on.
c.NotebookApp.port = 9999
Run Code Online (Sandbox Code Playgroud)