我正在使用matplotlib,使用python3.4。当我启动程序时,我会收到以下警告消息:
C:\Python34-32bits\lib\site-packages\matplotlib\cbook.py:123: MatplotlibDeprecationWarning:版本1.3中不推荐使用matplotlib.mpl模块。使用
import matplotlib as mpl代替。Warnings.warn(消息,mplDeprecation,stacklevel=1)
据我所知,我不使用mpl,所有有关matplotlib的导入都是:
import matplotlib.pyplot as plt
import matplotlib.animation as animation我该做些什么?
发布于 2014-07-01 05:13:51
您可以抑制特定的警告,这可能是首选的方法:
import warnings
import matplotlib.cbook
warnings.filterwarnings("ignore",category=matplotlib.cbook.mplDeprecation)发布于 2014-07-01 05:09:49
您可以在导入时使用暂时抑制警告
import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()发布于 2020-03-30 00:39:59
我能够用下面的代码来抑制这个警告:
import warnings
warnings.filterwarnings("ignore",category=UserWarning)https://stackoverflow.com/questions/24502500
复制相似问题