1. 程式人生 > >Jupyter Notebook 優化設定

Jupyter Notebook 優化設定

Jupyter Notebook原生態的主題和字型看著就讓人感到難受,為此,非常有必要為Jupyter Notebook尋找一款更加人性化、更炫酷的主題。同時為了提高寫程式碼的效率,對Jupyter Notebook設定程式碼自動補全。

 

主題設定:

主題下載:

pip install --no-dependencies jupyterthemes==0.18.2

安裝好了,有的電腦可能會提示缺少 lesscpy,繼續 pip 安裝

pip install lesscpy

然後是對主題選擇、字型大小進行設定,我總結了一個我最喜歡的

jt --lineh 140 -f consolamono -tf ptmono -t grade3 -ofs 14 -nfs 14 -tfs 14 -fs 14 -T -N

 命令列的格式的解釋如下表所示:

 效果圖:

 

jupyter notebook 實現自動程式碼補全:

首先安裝 nbextensions:

pip install jupyter_contrib_nbextensions

接著對其進行設定

jupyter contrib nbextension install --user

然後安裝 nbextensions_configurator,同樣對其進行設定

pip install jupyter_nbextensions_configurator

jupyter nbextensions_configurator enable --user

如果提示缺少依賴,就使用pip安裝對應依賴即可。

最後重啟jupyter,在彈出的主頁面裡,能看到增加了一個Nbextensions標籤頁,在這個頁面裡,勾選Hinterland即啟用了程式碼自動補全,如圖所示:

 

配置完畢!

開啟Jupyter Notebook看看效果吧!