jupyter notebook个性化

相比于pycharm,jupyter显然更适合轻量化,多输出的代码试写。定制漂亮的jupyter notebook就可以使得人心情愉悦。重装系统后迫不得已又来配置,好麻烦。希望不要再有下一次了

现在是win10系统,anaconda启动jupyter

一.安装扩展

1.整体流程参考的是这个链接

报错是关于wheel的,程序员终极bug之路

打造实用的Jupyter Notebook 扩展插件 - 知乎 (zhihu.com)

于是直接下载文件,然后pip

【nbextensions模块安装失败解决】ERROR: Failed building wheel for jupyter-nbextensions-configurator_failed building wheel for jupyter_contrib_nbextens-CSDN博客t

报错:time read out

然后用手机给电脑开热点,成功了,ok!

好好好,又报错了

WARNING: Failed to remove contents in a temporary directory 'f:\anaconda3-5.3.1\lib\site-packages\~arkupsafe'.
  You can safely remove it manually.

手动移除,即可解决

ERROR: 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.

忽略移除:pip install terminado --upgrade --ignore-installed terminado

DEPRECATION: pandas 0.23.4 has a non-standard dependency specifier pytz>=2011k.  pip 24.0 will enforce this behaviour change.  A possible replacement is to upgrade to a newer version of pandas or contact the author to suggest that they release a version with a conforming dependency specifiers.  Discussion can be found at https://github.com/pypa/pip/issues/12063

升级pandas:pip install --upgrade pandas

2.终于进展到第二句了:
jupyter contrib nbextension install --user
接下来都没什么问题,顺利完成

二、研究主题

本来直接把我的custom.css移过来就行,但是我忘记保存了,只好重新摸索

1.找到这个地址(ps:其实没有custom文件夹,自己建就行)

2.复制粘贴大佬的代码,后面慢慢调

自定义jupyter notebook界面样式 - 知乎 (zhihu.com)

/* Body */
/* #notebook-container {
    width: 90%
} */


/* 入场动画 */
@keyframes animatename {

    0% {
    opacity: 0;
    -webkit-transform: translateY(-100%);
    -ms-transform: translateY(-100%);
    transform: translateY(-100%);
    }

    100% {
    opacity: 1;
    webkit-transform: translateY(0);
    ms-transform: translateY(0);
    transform: translateY(0);
    }
}

@keyframes simpleEnter {

    0% {
    opacity: 0;
    }

    100% {
    opacity: 1;
    }
}
    


/*first page*/
div#site{
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 120%;
    line-height: 200%;
}

/* 设置第一页的属性 */
form.navbar-form.pull-left{
    background-color: rgba(240, 240, 250, 0.8);
    width: 110%;
    height: 200%;
    animation: animatename 2.0s;
}

/* 设置第二页的hover */
div.list_item.row:hover{
    background-color: rgba(153, 153, 255, 0.7);
    animation: simpleEnter 0.3s;
}

li:hover{
    background-color: rgba(153, 153, 255, 0.7);
}

li.dropdown:hover{
    background-color: rgba(153, 153, 255, 0.8);
}
a#filelink.dropdown-toggle:hover{
    background-color: rgba(153, 153, 255, 0.8);
}

div#cut_copy_paste.btn-group:hover{
    background-color: rgba(153, 153, 255, 0.8);
}
button.btn.btn-default:hover{
    background-color: rgba(153, 153, 255, 0.8);
}
/* Quit按钮 */
button#shutdown.btn.btn-sm.navbar-btn:hover{
    background-color: rgba(153, 153, 255, 0.8);
}
/* Logout按钮 */
button#logout.btn.btn-sm.navbar-btn:hover{
    background-color: rgba(153, 153, 255, 0.8);
}
/* 不可信按钮 */
div#notification_trusted.notification_widget.btn.btn-xs.navbar-btn:hover{
    background-color: rgba(153, 153, 255, 0.8);
}
/* Python版本提示框 */
p#kernel_indicator.navbar-text.indicator_area:hover{
    background-color: rgba(153, 153, 255, 0.8);
}
/* Upload按钮 */
span#upload_span.btn.btn-xs.btn-default.btn-upload:hover{
    background-color: rgba(153, 153, 255, 0.8);
}

/* 第二页的子控件入场动画 */
div.tab-content{
    animation: animatename 1.5 s;
}

div#nbextensions-configurator-container.nbextentions-configutator-container.container{
    animation: animatename 1.5 s;
}



/* body 顺便设置背景图片*/
body {
    height: 100%;width: 100%;
    background: url("https://i.loli.net/2020/09/16/EM1xdskGr9tKbpn.jpg");
    /* 背景图垂直、水平均居中 */
	background-position: center center;
	/* 背景图不平铺 */
	background-repeat: no-repeat;
	/* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */
	background-attachment: fixed;
	/* 让背景图基于容器大小伸缩 */
	background-size: cover;
	/* 设置背景颜色,背景图加载过程中会显示背景色 */
	background-color: rgba(250, 250, 250, alpha);
}

/* 登录界面的组件 */
/* 输入框 */
input #password_input.form-control{
    background-color: rgba(250, 250, 250, 0.5) !important;
}


/* 文件目录界面组件 */
div #tab_content{
    background-color: rgba(250, 250, 250, 0.7);
    animation: animatename 1.5s;
}

/* In[]和out[] */
div.prompt.input_prompt{
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
}


/* 顶部导航条 */
div#menubar-container.container{
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 9pt;
    background-color: rgba(250, 250, 250, 0.8);
}
div#header{
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 9pt;
    background-color: rgba(250, 250, 250, 0.9);
    animation: animatename 1.5s;
}

div#menus.navbar.navbar-default{
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 9pt;
    background-color: rgba(250, 250, 250, 0.8);
}

/* 文字及代码编辑区 */
div#menubar-container.container{
    background-color: rgba(250, 250, 250, 0.7);
    color: #C8C8FF;
}
div#notebook-container.container{
    background-color: rgba(250, 250, 250, 0.7);
}


/* 代码区*/
div.CodeMirror.cm-s-ipython{
    background-color: #FAFAFA;
}


/* Markdown */
div#notebook {
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    line-height: 20px;
    -webkit-font-smoothing: antialiased !important;
    animation: simpleEnter 2.5s;
}


/* Markdown - quote */
div#notebook blockquote{
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    background-color: #9999ff;
    color: #505050;
    padding: 8.5px;
    margin: 0.5em -0.5em 0.5em -0.4em;
}

/* Markdown - code in paragraph */
div#notebook p code, div#notebook li code {
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 16pt;
    color: #111111;
    border: 0.5px solid #cfcfcf;
    border-radius: 2px;
    background-color: #f7f7f7;
    padding: .1em .2em;
    margin: 0px 2px;
}

/* Markdown - code */
div.text_cell_render pre {
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    border: 1px solid #cfcfcf;
    border-radius: 2px;
    background: #f7f7f7;
    line-height: 1.21429em;
    padding: 8.5px;
    margin: 0.5em -0.5em 0.5em -0.4em;
}
div.text_cell_render code {
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    background: #f7f7f7;
}

/* Markdown - h1 */
div#notebook h1 {
    color:#263238;
    font-size: 24pt;
    font-family: UD Digi Kyokasho NK-R;
}

/* Markdown - h2 */
div#notebook h2 {
    color: #263238;
    font-size: 20pt;
    font-family: UD Digi Kyokasho NK-R;
}

/* Markdown - h3 */
div#notebook h3 {
    color: #263238;
    font-size: 18pt;
    font-family: UD Digi Kyokasho NK-R;
}

/* Markdown - h4 */
div#notebook h4 {
    color: #263238;
    font-size: 16pt;
    font-family: UD Digi Kyokasho NK-R;
}

/* Markdown - h5 */
div#notebook h5 {
    color: #263238;
    font-size: 14pt;
    font-family: UD Digi Kyokasho NK-R;
}

/* Code */
div.CodeMirror pre {
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 12pt;
    line-height: 120%;
    -webkit-font-smoothing: antialiased !important;
}


div.CodeMirror-cursor{
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 12pt;
    color: black;
}

div.CodeMirror-code{
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 12pt;
    line-height: 145%;
}

/* 代码输出部分 */
div.output pre {
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei";
    line-height: 20px;
    -webkit-font-smoothing: antialiased !important;
}

/* Code - comment */
span.cm-comment {
    font-family: UD Digi Kyokasho NK-R, "PingFangSC-Medium", "Microsoft YaHei" !important;
    font-style: normal !important;
}


/* 代码的语法高亮 */
/* 代码框中的光标 */
.cm-s-ipython .CodeMirror-cursor {
    border-left: 2.5px solid black !important;
    width: 100%;
}
.cm-s-ipython span.cm-comment, span.c1 {
    color: #8d8d8d !important;
}
.cm-s-ipython span.cm-atom {
    color: #055be0 !important;
}
.cm-s-ipython span.cm-number, span.mi {
    color: #ff8132 !important;
}
.cm-s-ipython span.cm-property {
    color: #303030 !important;
}
.cm-s-ipython span.cm-attribute {
    color: #303030 !important;
}
.cm-s-ipython span.cm-keyword, span.kn, span.k, span.ow, span.kc, span.bp {
    color: #713bc5 !important;
    font-weight: 520 !important;
}
.cm-s-ipython span.cm-string, span.s1, span.s2 {
    color: #009e07 !important;
}
span.se, span.si {
    color: #59c08d !important;
    font-weight: normal !important;
}
.cm-s-ipython span.cm-meta {
    color: #aa22ff !important;
}
.cm-s-ipython span.cm-operator, span.o {
    color: #055be0 !important;
    font-weight: bold !important;
}
.cm-s-ipython span.cm-builtin, span.nb {
    color: #e22978 !important;
}
.cm-s-ipython span.cm-variable, span.nn, span.n {
    color: #303030 !important;
    font-weight: normal !important;
}
.cm-s-ipython span.cm-variable-2 {
    color: #de143d !important;
}
.cm-s-ipython span.cm-variable-3 {
    color: #aa22ff !important;
}
.cm-s-ipython span.cm-def {
    color: #e22978 !important;
    font-weight: normal !important;
}
.cm-s-ipython span.cm-error {
    background: rgba(191, 97, 106, .40) !important;
}
.cm-s-ipython span.cm-tag {
    color: #e22978;
}
.cm-s-ipython span.cm-link {
    color: #ff8132 !important;
}
.cm-s-ipython span.cm-storage {
    color: #055be0 !important;
}
.cm-s-ipython span.cm-entity {
    color: #e22978 !important;
}
.cm-s-ipython span.cm-quote {
    color: #009e07 !important;
}
div.CodeMirror span.CodeMirror-matchingbracket {
    color: #1c1c1c !important;
    background-color: rgba(30, 112, 199, .30) !important;
}
div.CodeMirror span.CodeMirror-nonmatchingbracket {
    color: #1c1c1c !important;
    background: rgba(191, 97, 106, .40) !important;
}
.cm-s-default .cm-hr {
    color: #055be0 !important;
}

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值