轉(zhuǎn)載請(qǐng)?jiān)谖恼缕鹗继幾⒚鞒鎏幵不耍x謝个唧。
jupyter notebook默認(rèn)的主題為白色背景,長(zhǎng)期使用眼睛差點(diǎn)亮瞎,正好看到可以更換主題尽楔,想來(lái)可以換個(gè)保護(hù)下視力。
打開(kāi)cmder(點(diǎn)我點(diǎn)我)(比cmd更友好丰介,墻裂推薦)呀打,使用pip安裝(至于為啥conda不能安裝,我也不太清楚豌研,還望知道的大佬告知下)Github上大神提供的包jupyterthemes(點(diǎn)我點(diǎn)我)妹田。
1、jupyterthemes安裝
安裝之前請(qǐng)先將pip升級(jí)到最新鹃共。
python -m pip install --upgrade pip
如果下載比較卡鬼佣,可以臨時(shí)改用國(guó)內(nèi)源,即在命令結(jié)尾加上-i https://pypi.tuna.tsinghua.edu.cn/simple霜浴,后續(xù)安裝都可以晶衷。
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
安裝jupyterthemes。
pip install jupyterthemes -i https://pypi.tuna.tsinghua.edu.cn/simple
竟然報(bào)錯(cuò)了:
錯(cuò)誤信息:
Cannot uninstall 'jupyter-client'. It is a distutils installed project and thus we cannot accurate ly determine which files belong to it which would lead to only a partial uninstall.
百度下發(fā)現(xiàn)有大佬遇到過(guò)此類(lèi)問(wèn)題(原文點(diǎn)這里)阴孟,解決辦法直接到anaconda安裝目錄下晌纫,搜索對(duì)應(yīng)包的名字,刪掉對(duì)應(yīng)文件夾和.egg-info文件即可永丝。完美解決锹漱!
重新運(yùn)行安裝命令,完成jupyterthemes的安裝慕嚷。
Successfully installed jupyterthemes-0.20.0
2哥牍、選擇主題
通過(guò)以下命令查看主題種類(lèi)毕泌。
jt -l
有下面主題可以選擇。
我選擇monikai:
jt -t monokai
打開(kāi)jupyter notebook嗅辣,主題效果如下:
如果不喜歡撼泛,可以用上述命令更換其他主題。
如果還是喜歡原生的澡谭,命令如下:
jt -r
3愿题、設(shè)置主題參數(shù)
我的主題設(shè)置詳細(xì)參數(shù)如下:
jt -t oceans16 -f consolamono -tf ptmono -ofs 10 -nfs 13 -tfs 13 -fs 12 -T -N -lineh 140
效果如下:
更多參數(shù)設(shè)置,請(qǐng)參考jupyterthemes參數(shù)設(shè)置說(shuō)明:
4译暂、小彩蛋
設(shè)置好主題后抠忘,開(kāi)開(kāi)心心去打開(kāi)ipynb文件,然后外永。崎脉。
更新jupyter notebook后完美解決。
conda update jupyter notebook
至此伯顶,設(shè)置完成囚灼,開(kāi)心擼代碼去。