问题
i have two machines connected via lan. other system's ip address is 192.1xx.x.x i want to run jupyter ipython query's on my machine which can be exexuted on his machine. at the start of ipython notebook, there is a black screen which contains this:
[I 11:12:52.802 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
can i change this to my specified location?
回答1:
You can specify the port you want Jupyter to run uncommenting/editing the following line in ~/.jupyter/jupyter_notebook_config.py
:
#c.NotebookApp.port = 8888
In case you don't have a jupyter_notebook_config.py
try running jupyter notebook --generate-config
. See this for further details on Jupyter configuration.
In case you are accessing Jupyter at a remote machine you can also try just leaving Jupyter running at its default port and make an SSH tunnel to your local machine at the port you want, e.g.:
ssh -fNL <new port>:localhost:8888 <your ssh config>
回答2:
First you need to generate a configuration file by typing:
$> jupyter notebook --generate-config
Writing default config to: /{home-directory}/.jupyter/jupyter_notebook_config.py
Next you need to edit that configuration to change the port number:
vi /{home-directory}/.jupyter/jupyter_notebook_config.py
Look for the following line (which is commented out by default) and comment in the line and change the port number:
(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
回答3:
Run the Anaconda Prompt, generate the config file, if you don't have it and edit the config file and change c.NotebookApp.ip with your IP Adress '192.1xx.x.x'
On Anaconda Prompt: If the file not exist, generate a config file:
jupyter notebook --generate-config
Output:
(base) C:\Users\youruser>jupyter notebook --generate-config
Writing default config to: C:\Users\youruser\.jupyter\jupyter_notebook_config.py
(base) C:\Users\youruser>
Change to jupyter directory:
cd .jupyter
Modify the config file from:
## The IP address the notebook server will listen on.
#c.NotebookApp.ip = 'localhost'
To:
## The IP address the notebook server will listen on.
c.NotebookApp.ip = '192.1xx.x.x'
来源:https://stackoverflow.com/questions/40373330/change-jupyter-notebooks-localhost8888-default-server-with-other