Python基礎——Windows安裝Jupyter Notebook


如果你的Python環境是通過anaconda安裝的話,anaconda會預裝Jupyter Notebook。

前置需求

Jupyter NoteBook安裝

如果過你還沒有安裝Python請先安裝!!

  • 如果你有多個Python版本,並且你想要安裝Jupyter的版本並不是你當前環境變量中的版本,請先在命令行中跳轉到你要安裝的Python版本中的Scripts文件夾中

  • 打開cmd或者PowerShell輸入jupyter安裝指令

pip install jupyter

如果下載速度慢的話可以嘗試臨時更換鏡像源下載(如果已經安裝請勿重複此語句

pip install jupyter -i https://pypi.tuna.tsinghua.edu.cn/simple/
# -  阿里雲 http://mirrors.aliyun.com/pypi/simple/ 
# -  中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/ 
# -  豆瓣(douban) http://pypi.douban.com/simple/ 
# -  清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/ 
# -  中國科學技術大學 http://pypi.mirrors.ustc.edu.cn/simple/

出現succellfull installed說明安裝結束

  • 輸出pip以安裝軟件包列表,確認jupyter確實安裝成功
pip list

Jupyter NoteBook配置

啓動jupyter

其實jupyter notebook在windows的配置方法和Linux大致相同

  • 選擇一個文件夾按住shift+鼠標右鍵,選擇在此處打開PowerShell

  • 在彈出的窗口中輸入jupyter notebook啓動jupyter notebook
    默認啓動路徑爲你終端執行的路徑,默認啓動端口爲8888
    在瀏覽器輸入localhost:8888/tree即可進入

配置jupyter

  • 生成jupyter配置文件
    在命令行中輸入指令
jupyter notebook --generate-config

  • 設置jupyter notebook默認啓動目錄與端口
    打開生成的jupyter_notebook_config.py,找到或直接添加參數
c.NotebookApp.notebook_dir = "你的jupyter notebook項目絕對路徑"
c.NotebookApp.port = 8848
  • 配置參數參考
參數 功能
c.NotebookApp.ip 允許訪問jupyter notebook的ip 設置爲* 默認所有ip均可訪問
c.NotebookApp.port jupyter notebook默認訪問端口
c.NotebookApp.notebook_dir jupyter notebook默認啓動根目錄
c.NotebookApp.password jupyter notebook登陸密碼,此密碼爲哈希密碼

Jupyter設置登陸密碼

  • notebook5.0版本以上可以直接通過jupyter notebook指令設置密碼
jupyter notebook password

參考文獻

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章