1. 程式人生 > >jupyter notebook 外掛包安裝與工作路徑設定方法

jupyter notebook 外掛包安裝與工作路徑設定方法

一、jupyter notebook 外掛包安裝

1、安裝外掛包:

在cmd命令列裡輸入

pip install jupyter_contrib_nbextensions

2、安裝javascript和css檔案

這一步將nbextensions的javascript和css檔案複製到jupyter伺服器的搜尋目錄中,並編輯一些jupyter配置檔案。

jupyter contrib nbextension install --user

3、啟用外掛包

在cmd命令列裡輸入jupyter notebook,在開啟的網頁裡就可以看到這個擴充套件包視窗了。

二、工作路徑設定方法

ipython notebook 改名叫jupyter了。

在cmd中,​輸入“ipython notebook”或“jupyter notebook”開啟notebook,此時cmd的當前路徑即為notebook的工作路徑。

另外,可通過設定config檔案的方法來設定固定的工作路徑。

方法是:

1 選擇一個用於存放config檔案的資料夾

2 在cmd中進入該資料夾的路徑

3在cmd中 輸入​命令jupyter notebook --generate-config

4 此時在該資料夾中便生成一個notebook的config檔案​,檔名是“jupyter_notebook_config.py”

​5 開啟該檔案,修改

“# The directory to use for notebooks and kernels.”下面的

“# c.NotebookApp.notebook_dir = ””​為

“c.NotebookApp.notebook_dir = ‘指定的工作路徑’”​(注意將#號刪除)

配置檔案位置 
C:\Users\使用者名稱.jupyter\jupyter_notebook_config.py