zoukankan      html  css  js  c++  java
  • python 日常碰到的问题检索

    1、python查看包的安装路径打开cmd -> pip show matplotlib

    2、pandas 作图无法显示中文

    原因是 matplotlib 包默认只支持 ASCII 码,不支持 unicode 码。

    解决方法,就是需要将 matplotlib 的安装目录下的 matplotlibrc 配置文件修改一下,将font.family 部分(大概在139行左右)注释去掉,并且在 font.seriffont.sans-serif 支持字体加上一个中文字体,如 SimHei:

    font.family         : sans-serif
    #font.style          : normal
    #font.variant        : normal
    #font.weight         : medium
    #font.stretch        : normal
    # note that font.size controls default text sizes.  To configure
    # special text sizes tick labels, axes, labels, title, etc, see the rc
    # settings for axes and ticks. Special text sizes can be defined
    # relative to font.size, using the following values: xx-small, x-small,
    # small, medium, large, x-large, xx-large, larger, or smaller
    #font.size           : 12.0
    font.serif          : SimHei, Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
    font.sans-serif     : SimHei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
    #font.cursive        : Apple Chancery, Textile, Zapf Chancery, Sand, cursive
    #font.fantasy        : Comic Sans MS, Chicago, Charcoal, Impact, Western, fantasy
    #font.monospace      : Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, 

    最终实现了正常显示中文。

    这里写图片描述

  • 相关阅读:
    JAVA 高级特性 JDBC
    C3P0 连接池
    JAVA WEB Servlet
    JAVAWEB JSP
    sed 命令
    shell 简单脚本编程
    从首页问答标题到问答详情页
    首页列表显示全部问答,完成问答详情页布局
    制作首页的显示列表
    发布功能完成
  • 原文地址:https://www.cnblogs.com/xitingxie/p/8359418.html
Copyright © 2011-2022 走看看