jupyter notebook非常方便队萤,想在服務器上面搭建一個咐熙,但是訪問不了汹粤。
(一)首先是安裝jupyter notebook箩做,
pipinstalljupyter
如果pip安裝報錯虫腋,缺少sqlite的庫骄酗,那么請安裝
sudo apt-getinstall libsqlite3-dev
然后需要“重新編譯python”,再通過pip安裝(python3.x則不需要安裝pysqlite)
pipinstallpysqlite
(二)啟動jupyter
jupyter notebook
其實這時候悦冀,local如果有browser的話趋翻,就可以輸入訪問了,但是沒有盒蟆,所以需要遠程訪問: http://ip:8888踏烙,發(fā)現(xiàn)訪問不了
(三)配置遠程訪問jupyter
1)首先輸入ipython生成秘鑰
$ ipython
fromnotebook.authimportpasswd
passwd()
設(shè)定一個密碼,會生成一個sha1的秘鑰历等,如下圖:
2)生成jupyter的config文件
$ jupyter notebook--generate-config
這時候會生成配置文件讨惩,在 ~/.jupyter/jupyter_notebook_config.py
3)修改配置文件:~/.jupyter/jupyter_notebook_config.py
$vim ~/.jupyter/jupyter_notebook_config.py
加入如下內(nèi)容,其中sha1那一串秘鑰是上面生成的那一串
c.NotebookApp.ip='*'
c.NotebookApp.password =u'sha1:f9030dd55bce:75fd7bbaba41be6ff5ac2e811b62354ab55b1f63'
c.NotebookApp.open_browser =False
c.NotebookApp.port =8888
如圖:
保存退出募闲。
4)啟動jupyter
$jupyter notebook
在遠程電腦上步脓,打開瀏覽器,輸入:
http://your-server-ip:8888
需要輸入密碼,就是上面設(shè)置的那個密碼靴患,輸入即可
5)OK了仍侥。