导入seaborn错误:Matplotlib support f
2020-07-21 本文已影响0人
遥远的清平湾
问题描述
Python 3.6.6版本中导入seaborn包(版本0.10.1)出错,如下图所示。虽然不影响后续画图,程序还可以继续运行,但是每次运行程序时console中都出现这些红色字体还是很难看的(强迫症)。
image.png
import seaborn as sn
$\color{red}{Matplotlib support failed}$
Traceback (most recent call last):
File "C:\Users\Song\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\201.7846.77\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 25, in do_import
succeeded = activate_func()
File "C:\Users\Song\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\201.7846.77\plugins\python\helpers\pydev\pydev_ipython\matplotlibtools.py", line 155, in activate_pylab
pylab = sys.modules['pylab']
KeyError: 'pylab'
解决方法
在导入seaborn包之前导入pylab包,即可,如下图
image.png