import numpy as np
import matplotlib.pyplot as plt
提供错误
Traceback (most recent call last):
File "/home/xx/PycharmProjects/Udemy/Array_Processing.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/home/xx/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 27, in <module>
import matplotlib.colorbar
File "/home/xx/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py", line 34, in <module>
import matplotlib.collections as collections
File "/home/xx/anaconda/lib/python2.7/site-packages/matplotlib/collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "/home/xx/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 56, in <module>
import matplotlib.textpath as textpath
File "/home/xx/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py", line 22, in <module>
from matplotlib.mathtext import MathTextParser
File "/home/xx/anaconda/lib/python2.7/site-packages/matplotlib/mathtext.py", line 63, in <module>
import matplotlib._png as _png
ImportError: libpng15.so.15: cannot open shared object file: No such file or directory
有没有什么办法解决这一问题?我假设该软件包未正确安装。我主要使用 Windows 来进行 python 编码,但是,是的,不确定在这里做什么。
如果还没有,请尝试
matplotlib
通过conda
命令安装。anaconda 的库与通过 pip 等为 python 安装的库分开。我猜 anaconda 实际上找不到图书馆。另一种可能是它使用了不兼容的库,在这种情况下卸载 matplotlib 然后使用conda
安装。看来,由于我是运行
anaconda
的,依赖和包需要自己在虚拟环境中安装。因此,
conda install matplotlib
是解决方案。