LoginSignup
0
1

More than 3 years have passed since last update.

jupyter notebookを別のhostから接続して使う

Last updated at Posted at 2020-07-10

jupyter notebookをローカルエリアのマシンから利用する。

違う環境で動作確認とかする為に以下のjupterを別のマシンから使えるようにしたメモ
- macOS 15.5
- ubuntu 20.4

やり方は同様です
Anacondaで導入した物でも。pipでjupterを導入しても同じです

ホームの.jupyterディレクトリに、jupyter_notebook_config.pyを置いて設定を書くだけです。
~/.jupyter/jupyter_notebook_config.py

作らせる:

 jupyter notebook --generate-config

手動で書いても良い

パスワード shaの作成

$ ipython
In [1]: from IPython.lib import passwd                                          
In [2]: passwd()             
Enter password: 
Verify password: 
Out[2]: 'sha1:abc345fgyy...........................'

このsha1:の値を使うのでメモっておく

jupyter_notebook_config.py

c = get_config()
c.IPKernelApp.pylab = 'inline'
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.password = u'sha1:abc345fgyy........................'

説明:
c.NotebookApp.ip は、サブネットマスク指定です
0.0.0.0 は全てです。
255.255.255.0 では256のNetworkです 192.168.x.xのnetwork等に使う

c.NotebookApp.open_browserは、serverを上げたときにbrowserを起動するかです
c.NotebookApp.portは、接続ポートです。8080とか、8880とかご自由に

あとは、他のhostのブラウザーから
server_address:8888
で接続すると、パスワードを聞かれます、

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1