Python/matplotlib:摆脱 matplotlib.mpl 警告 [英] Python/matplotlib : getting rid of matplotlib.mpl warning

查看:43
本文介绍了Python/matplotlib:摆脱 matplotlib.mpl 警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python 3.4使用matplotlib.当我启动我的程序时,我收到以下警告消息:

I am using matplotlib using python 3.4. When I start my program, I have the following warning message:

C:\Python34-32bits\lib\site-packages\matplotlib\cbook.py:123:MatplotlibDeprecation警告:不建议使用matplotlib.mpl模块在 1.3 版中.使用 import matplotlib as mpl 代替.warnings.warn(message, mplDeprecation, stacklevel=1)

C:\Python34-32bits\lib\site-packages\matplotlib\cbook.py:123: MatplotlibDeprecationWarning: The matplotlib.mpl module was deprecated in version 1.3. Use import matplotlib as mpl instead. warnings.warn(message, mplDeprecation, stacklevel=1)

据我所知,我不使用 mpl,我所有关于 matplotlib 的导入是:

As far as I know I do not use mpl, and all my imports concerning matplotlib are:

import matplotlib.pyplot as plt
import matplotlib.animation as animation

我该做什么?

推荐答案

您可以取消该特定警告,这可能是首选方式:

You can suppress that particular warning, which is probably the preferred way:

import warnings
import matplotlib.cbook
warnings.filterwarnings("ignore",category=matplotlib.cbook.mplDeprecation)

这篇关于Python/matplotlib:摆脱 matplotlib.mpl 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆