我对 python 的基本设置

python下载

前往python官网进行下载。

pip更换国内源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

下面是常用国内源

阿里云 http://mirrors.aliyun.com/pypi/simple/
豆瓣 http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
华中科技大学 http://pypi.hustunique.com/

安装常用包

jupyter notebook

pip install jupyter notebook

notebook插件

pip install jupyter_contrib_nbextensions jupyter_nbextensions_configurator
jupyter contrib nbextension install

修改notebook样式
notebook自定义样式文件地址

python根目录\Lib\site-packages\notebook\static\custom.css

我的样式

/*
Placeholder for custom user CSS

mainly to be overridden in profile/static/custom/custom.css

This will always be an empty file
*/

/* body宽度 */
#notebook-container {
    width: 100%;
}

/* 头部拉宽 */
#header div#menubar-container,
#header div#header-container {
    width: 99%;
    padding: 0;
}

/* 代码块和头部之间的距离 */
div#notebook{
    padding-top: 0;
}

/* 输入代码框圆角并显示偏向于中间 */
div.input_area {
    border-radius: 10px;
    width: 93%;
}

/* 消除选中代码块的边框 */
div.cell.selected, div.cell.selected.jupyter-soft-selected {
    border: none;
}

/* 给选中代码块的右侧添加左侧相同提示 */
div.cell.selected:after, div.cell.selected.jupyter-soft-selected:after {
    position: absolute;
    display: block;
    top: -1px;
    right: -1px;
    width: 5px;
    height: calc(100% + 2px);
    content: '';
    background: #42A5F5;
}

/* 输出信息的宽度 */
div.output_area pre {
    width: 93%;
}

/* Markdown */
div#notebook {
    font-family: san francisco, "PingFangSC-Medium", "Microsoft YaHei";
    line-height: 20px;
    -webkit-font-smoothing: antialiased !important;
}

div#notebook h1 {
    color: #9900ff;
}

div#notebook h2 {
    color: #007aff;
}

div#notebook h3 {
    color: #ff9900;
}

div#notebook h4 {
    color: #ffee00;
}
div#notebook h5 {
    color: #00ff2f;
}

/* Markdown - quote */
div#notebook blockquote{
    background-color: #f8f8f8;
    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: Consolas, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 1em !important;
    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 {
    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 {
    background: #f7f7f7;
}

/* Code */
div.CodeMirror-code {
    font-family: Consolas, "PingFangSC-Medium", "Microsoft YaHei";
    font-size: 13pt;
    line-height: 145%;
    -webkit-font-smoothing: antialiased !important;
}

/* Code - output */
div.output pre {
    font-family: Consolas, "PingFangSC-Medium", "Microsoft YaHei";
    line-height: 20px;
    -webkit-font-smoothing: antialiased !important;
}

/* Code - comment */
span.cm-comment {
    font-family: san francisco, "PingFangSC-Medium", "Microsoft YaHei" !important;
    font-style: normal !important;
}

VScode

  1. 安装插件
  2. 为了避免python文件运行时运行路径为项目路径的问题,我们需要对拓展进行设置。

    允许执行文件的路径为文件所在路径,而非项目路径。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值