安裝方法
-
安裝
若jupyter notebook是conda安裝的汉规,強(qiáng)烈建議用conda安裝jupyterthemes礼殊,不然若用pip安裝jupyterthemes,會(huì)出現(xiàn)多種依賴不匹配
conda install -c conda-forge jupyterthemes
若jupyter notebook是pip安裝的针史,則
pip install jupyterthemes
-
配置
終端下輸入以下命令
jt -t gruvboxd -T -N
意為使用 gruvboxd 主題晶伦,打開頂部工具欄(Toolbar),顯示文件名(Name)
運(yùn)行過程中可能會(huì)返回報(bào)錯(cuò)如下啄枕,這說明已經(jīng)別的用戶安裝了jupyterthemes婚陪,并重建了
/tmp/yacctab.py
,故你無法重寫這個(gè)文件频祝,這并不運(yùn)行你使用jupyter notebook的配色泌参。你的配色設(shè)置智润,保存到$HOME/.jupyter/custom/
及舍,不和他的配色設(shè)置沖突。WARNING: Couldn't create 'yacctab'. [Errno 13] Permission denied: '/tmp/yacctab.py'
WARNING: Couldn't create 'yacctab'. [Errno 13] Permission denied: '/tmp/yacctab.py' -
配置文件
配置文件保存到了
$HOME/.jupyter/custom/
窟绷,下是四個(gè)配置和依賴文件current_theme. txt, custom.css, custom.js, fonts/
锯玛,之后每次執(zhí)行jupyter notebook
啟動(dòng)notebook時(shí),會(huì)加載此配置兼蜈,看見你要的主題攘残。
依賴不匹配怎么解決
若jupyter notebook是conda安裝,卻用安裝pip安裝jupyterthemes为狸,會(huì)出現(xiàn)多種依賴不匹配歼郭,最終如下裝一圈依賴,才能安裝成功
conda upgrade notebook libsodium
pip install jupyterthemes
pip install --upgrade --user nbconvert
pip install --upgrade ipykernel
以下是各個(gè)依賴不匹配的詳解:
Found existing installation: terminado 0.6
執(zhí)行pip install jupyterthemes
時(shí)報(bào)錯(cuò)
notebook 5.7.6 has requirement jupyter-core>=4.4.0, but you'll have jupyter-core 4.3.0 which is incompatible.
Installing collected packages: lesscpy, terminado, pyzmq, jupyter-client, prometheus-client, Send2Trash, notebook, jupyterthemes
Found existing installation: terminado 0.6
Cannot uninstall 'terminado'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
這是因?yàn)椴≡鲜霾僮髦衟ip自動(dòng)更新了notebook漾根,但這個(gè)notebook是用conda而非pip裝的,故依賴項(xiàng)terminado不對(duì)
解決方法:
conda upgrade notebook
而后可正常安裝
pip install jupyterthemes
ImportError: libsodium.so.23
執(zhí)行jupyter notebook
辐怕,報(bào)錯(cuò)
ImportError: libsodium.so.23: cannot open shared object file: No such file or directory
這是由于jupyterthemes
依賴的libsodium
沒有更新
解決辦法:
conda update libsodium
# 或
conda install -c conda-forge libsodium
ModuleNotFoundError: No module named 'nbconvert.exporters.base'
運(yùn)行notebook時(shí)寄疏,用瀏覽器成功打開notebook的目錄網(wǎng)頁僵井,但無法打開/新建python3 的 notebook文件驳棱,命令行下報(bào)錯(cuò)
ModuleNotFoundError: No module named 'nbconvert.exporters.base'
[E 20:28:58.544 NotebookApp]
這是因?yàn)椋@是由于jupyterthemes
依賴的nbconvert
沒有更新
解決辦法:
pip install --upgrade --user nbconvert
然后將$USER/.local/bin
添加到PATH渊季,即可實(shí)現(xiàn)上述運(yùn)行
ERROR:tornado.general: Uncaught exception in zmqstream callback
運(yùn)行notebook時(shí)罚渐,用瀏覽器成功打開notebook的目錄網(wǎng)頁,能成功打開/新建python3 的 notebook文件合砂,但點(diǎn)運(yùn)行源织,遲遲不運(yùn)行,命令行下報(bào)錯(cuò)
ERROR:tornado.general: Uncaught exception in zmqstream callback
這是因?yàn)樵狄伲@是由于jupyterthemes
依賴的ipykernel
沒有更新
解決辦法:
pip install --upgrade ipykernel