ValueError matplotlib display text must have all code points 128 or use Unicode strings
生活随笔
收集整理的這篇文章主要介紹了
ValueError matplotlib display text must have all code points 128 or use Unicode strings
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
錯誤問題:ValueError: matplotlib display text must have all code points < 128 or use Unicode strings
錯誤原因:在使用matplotlib進行圖表展示時,如果需要在圖表上添加中文,可能會報字符類型的值錯誤。
解決辦法:重新調用系統,修改默認的字符類型。
import sys reload(sys) sys.setdefaultencoding('utf-8')說明:一般在我們寫程序的過程中,經常會遇到這種字符類型錯誤,可以嘗試從了解系統的字符類型和編譯器等字符類型是否統一入手,如果有中文英文,盡可能使用utf-8.
總結
以上是生活随笔為你收集整理的ValueError matplotlib display text must have all code points 128 or use Unicode strings的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux查看登录服务器的ip历史记录,
- 下一篇: java 定时器框架_java定时器