简体   繁体   English

导入matplotlib不起作用

[英]Importing matplotlib does not work

In my terminal window, i open the ipython enviroment, and then type in import matplotlib.pyplot as plt . 在终端窗口中,打开ipython环境,然后输入import matplotlib.pyplot as plt The error message I get from doing this is: 通过执行此操作得到的错误消息是:

ImportError                               Traceback (most recent call last)
<ipython-input-1-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt

/Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
     25 
     26 import matplotlib
---> 27 import matplotlib.colorbar
     28 from matplotlib import style
     29 from matplotlib import _pylab_helpers, interactive

/Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py in <module>()
     32 import matplotlib.artist as martist
     33 import matplotlib.cbook as cbook
---> 34 import matplotlib.collections as collections
     35 import matplotlib.colors as colors
     36 import matplotlib.contour as contour

/Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/collections.py in <module>()
     25 import matplotlib.artist as artist
     26 from matplotlib.artist import allow_rasterization
---> 27 import matplotlib.backend_bases as backend_bases
     28 import matplotlib.path as mpath
     29 from matplotlib import _path

/Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py in <module>()
     54 
     55 import matplotlib.tight_bbox as tight_bbox
---> 56 import matplotlib.textpath as textpath
     57 from matplotlib.path import Path
     58 from matplotlib.cbook import mplDeprecation

/Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py in <module>()
     20 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
     21 from matplotlib.ft2font import LOAD_TARGET_LIGHT
---> 22 from matplotlib.mathtext import MathTextParser
     23 import matplotlib.dviread as dviread
     24 from matplotlib.font_manager import FontProperties

/Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/mathtext.py in <module>()
     61 
     62 import matplotlib.colors as mcolors
---> 63 import matplotlib._png as _png
     64 ####################
     65 

ImportError: dlopen(/Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/_png.so, 2): Library not loaded: @loader_path/../../../libpng15.15.dylib
  Referenced from: /Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/_png.so
  Reason: image not found

I would truly appreciate a way to resolve this issue. 我将非常感谢您解决此问题的一种方法。 All I want to do is get on with my physics, and all this constant computational setback is quite cumbersome and annoying. 我想做的就是继续学习物理,所有这些不断的计算挫折都非常麻烦和烦人。 I should thus appreciate an expedited response from anyone who may be willing to assist. 因此,我应该感谢任何愿意协助的人的迅速答复。

ImportError: dlopen(/Users/arazipinhas/anaconda/lib/python2.7/site-packages/matplotlib/_png.so, 2):
Library not loaded: @loader_path/../../../libpng15.15.dylib

really simple: Your matplotlib was linked against libpng15, but that isn't found by your run-time. 真的很简单:您的matplotlib与libpng15链接在一起,但是在运行时找不到。 So you might search for that file, libpng15.15.dylib . 因此,您可以搜索该文件libpng15.15.dylib If it's missing, your installation is incomplete and you're probably missing the version of libPNG that was used to build matplotlib. 如果缺少该文件,则说明您的安装不完整,并且您可能缺少用于构建matplotlib的libPNG版本。

Continuum recently updated libpng, which caused this breakage. Continuum最近更新了libpng,这导致了此损坏。 Sorry for the inconvenience. 抱歉给你带来不便。

The way to fix this error is to run in a terminal 解决此错误的方法是在终端中运行

conda update qt
conda update matplotlib 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM