Python Jupyter 網站編輯器

Python Jupyter 網站編輯器python

  jupyter 是 python的網站編輯器能夠直接在網頁內編寫python代碼並執行,內置是經過ipython來調用的。很方便靈活。linux

安裝瀏覽器

一、安裝ipython,jupyter服務器

pip install ipython
pip install jupyter

二、生成配置文件ssh

jupyter notebook --generate-config 
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
輸出

三、生成密碼編輯器

# 進入ipython
ipython
# 引入模塊
from notebook.auth import passwd
# 輸入方法
passwd()
# 填寫密碼
Enter password:  
Verify password:  
# 複製下方加密密碼
Out[2]: 'sha1:43b95b731276:5d330ee6f6054613b3ab4cc59c5048ff7c70f549'    In [3]:  

四、修改配置文件ide

# 進入配置文件下
vi /root/.jupyter/jupyter_notebook_config.py
# 設置訪問notebook的ip *表示全部IP,這裏設置ip爲均可訪問
c.NotebookApp.ip='*'
# 填寫剛剛生成的密文
c.NotebookApp.password = u'sha1:5df252f58b7f:bf65d53125bb36c085162b3780377f66d73972d1' 
# 禁止notebook啓動時自動打開瀏覽器(在linux服務器通常都是ssh命令行訪問,沒有圖形界面的。因此,啓動也沒啥用) 
c.NotebookApp.open_browser = False
# 指定訪問的端口,默認是8888。 
c.NotebookApp.port =8889

五、啓動 jupyter 服務網站

jupyter notebook --no-browser

六、訪問加密

瀏覽器: http://xxx:8889/

使用spa

一、建立使用文件

使用快捷鍵

  - 插入cell:a b  - 刪除:x  - 執行:shift+enter  - tab:自動補全  - cell模式切換:y(m->code) m(code->m)  - 打開幫助文檔:shift+tab    案例:      import numpy as np      np.linspace() # 按shift+tab 有提供使用案例

相關文章
相關標籤/搜索