Python Jupyter 網站編輯器


Python Jupyter 網站編輯器

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

安裝

1、安裝ipython,jupyter

pip install ipython
pip install jupyter

2、生成配置文件

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

3、生成密碼

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

4、修改配置文件

# 進入配置文件下
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

5、啟動 jupyter 服務

jupyter notebook --no-browser

6、訪問

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

使用

1、創建使用文件

使用快捷鍵

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM