我卸载了matplotlib,尝试重新安装它并且无法导入。 [OS X]

时间:2015-08-13 06:52:44

标签: python matplotlib

我尝试解决这个问题后所理解的是我安装了matplotlib,但python没有利用它来绘制内容。

我遇到了一些错误消息:

from matplotlib import pyplot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pyplot.py", line 28, in <module>
    import matplotlib.colorbar
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/colorbar.py", line 34, in <module>
    import matplotlib.collections as collections
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/collections.py", line 27, in <module>
    import matplotlib.backend_bases as backend_bases
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backend_bases.py", line 61, in <module>
    import matplotlib.textpath as textpath
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/textpath.py", line 15, in <module>
    import matplotlib.font_manager as font_manager
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/font_manager.py", line 58, in <module>
    from matplotlib import ft2font
ImportError: dlopen(/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/ft2font.so, 2): Library not loaded: libfreetype.6.dylib
  Referenced from: /Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/ft2font.so
  Reason: image not found

我google搜索图片未找到错误,matplotlib重新安装等等......但没有任何效果。

这是否与os x的版本有关?我正在使用约塞米蒂。

1 个答案:

答案 0 :(得分:-1)

Here信息。

>>> import pkgutil
>>> package = pkgutil.get_loader("matplotlib")
>>> package.filename
'/usr/local/lib/python2.7/dist-packages/matplotlib'
>>> 

那么你的&#34; matplotlib&#34; ?

COPY:

/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-p‌‌​​y2.7-macosx-10.5-x86_64.egg

TO:/usr/local/lib/python2.7/site-packages/ 或者:

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/