首先是要 安裝 Anaconda 。html
默認狀況下,安裝好 Anaconda 後打開 jupyter notebook, 訪問本地
localhost:8888
便可。可是若是要訪問另外一臺機器,好比遠端服務器上的 notebook, 即默認是不支持 172.104.105.119:8888
這樣的訪問,須要額外配置。python
設置 jupyter notebook 可遠程訪問的官方指南在這裏,在遠端服務器上執行如下操做:linux
默認狀況下,配置文件 ~/.jupyter/jupyter_notebook_config.py
並不存在,須要自行建立。使用下列命令生成配置文件:json
jupyter notebook --generate-config
若是是 root 用戶執行上面的命令,會發生一個問題:ubuntu
Running as root it not recommended. Use --allow-root to bypass.
提示信息很明顯,root 用戶執行時須要加上 --allow-root
選項。瀏覽器
jupyter notebook --generate-config --allow-config
執行成功後,會出現下面的信息:服務器
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
從 jupyter notebook 5.0 版本開始,提供了一個命令來設置密碼:jupyter notebook password
,生成的密碼存儲在 jupyter_notebook_config.json
。編輯器
$ jupyter notebook password Enter password: **** Verify password: **** [NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json
除了使用提供的命令,也能夠經過手動安裝,我是使用的手動安裝,由於jupyter notebook password
出來一堆內容,沒耐心看。打開 ipython 執行下面內容:spa
In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed
這一串就是要在 jupyter_notebook_config.py
添加的密碼。code
c.NotebookApp.password = u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
在 jupyter_notebook_config.py
中找到下面的行,取消註釋並修改。
c.NotebookApp.ip='*' c.NotebookApp.password = u'sha:ce...剛纔複製的那個密文' c.NotebookApp.open_browser = False c.NotebookApp.port =8888 #可自行指定一個端口, 訪問時使用該端口
以上設置完之後就能夠在服務器上啓動 jupyter notebook,jupyter notebook
, root 用戶使用 jupyter notebook --allow-root
。打開 IP:指定的端口
, 輸入密碼就能夠訪問了。
須要注意的是不能在隱藏目錄 (以 . 開頭的目錄)下啓動 jupyter notebook, 不然沒法正常訪問文件。
執行以下代碼修改Jupyter的一部分文件的權限(執行完以後從新啓動便可):
sudo chmod 777 ~/.local/share/jupyter/ cd ~/.local/share/jupyter/ ls sudo chmod 777 runtime/ cd runtime/ ls
改完以後就沒有問題啦!
今天用Jupyter又出問題了,過程是這樣的,我複製了以前製做的一個模板文件夾,cd進去以後運行Jupyter.py文件,自動打開瀏覽器以後顯示以下錯誤:
an error occurred while creating a new notebook
Create Untitled.ipynb [Errno 13] Permission denied:
當你點擊瀏覽器上的python2或者python3來建立新的Untitled.ipynb時,就會提示你Permission denied:,權限不足~
好吧,既然你說權限不足,那咱們就用sudo指令看看會怎樣吧(結果以下):
好,提示我你不要用sudo,沒用的,就是建立不了,接着想:會不會是應爲文件夾的權限問題致使我沒有權限寫數據到問價夾當中呢?因而我檢查了以前能建立性的notebook的文件夾的權限:l
上圖是我已經修改過以後的結果(修改指令:chmod改權限 chown改歸屬者 chgrp改歸屬組):
文件夾的權限應該爲:drwxrwxr-x
文件的組應該屬於:ubuntu-mm
文件的歸屬者應該爲:ubuntu-mm
一樣的內部的文件的權限以下:
若是你的文件夾或者文件夾或者文件不是上面你的權限狀況,那你但是改爲上面的狀況適宜時,說不定這樣你就能用啦~
一、修改 tmp 目錄所屬用戶爲 root,用戶組爲 root
chown -R root:root /tmp
二、修改 tmp 目錄爲可寫權限
chmod -R 777 /tmp
解決辦法
輸入jupyter kernelspec list
查看安裝的內核和位置