ImportError:无法从python中的“ matplotlib”导入名称“ get_backend”。为什么?

时间:2019-01-11 04:26:45

标签: python matplotlib

我已经安装了anaconda并安装了matplotlib,一切正常。但是一旦我使用here

中的conda conda install -c anaconda nccl安装了nccl,

在下一次之后,我无法导入matplotlib,出现以下错误:

>>> import matplotlib.pyplot as plt    
Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File
"/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/__init__.py",
line 1111, in <module>
rcParamsOrig = RcParams(rcParams.copy())   File "/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/__init__.py",
line 891, in __getitem__
from matplotlib import pyplot as plt   File "/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/pyplot.py",
line 32, in <module>
import matplotlib.colorbar   File "/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/colorbar.py",
line 40, in <module>
import matplotlib._constrained_layout as constrained_layout   File "/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/_constrained_layout.py",
line 52, in <module>
from matplotlib.legend import Legend   File "/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/legend.py",
line 43, in <module>
from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea   File
"/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/offsetbox.py",
line 33, in <module>
from matplotlib.image import BboxImage   File "/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/image.py",
line 19, in <module>
from matplotlib.backend_bases import FigureCanvasBase   File "/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/backend_bases.py",
line 46, in <module>
from matplotlib import ( ImportError: cannot import name 'get_backend' from 'matplotlib'
(/home/rofelia/anaconda3/envs/pytorch04/lib/python3.7/site-packages/matplotlib/__init__.py)

我无法找到解决方案。请帮帮我。谢谢。

0 个答案:

没有答案