我尝试通过 pip 和常规 python setup.py 方式安装 matplotlib,这两种方法都导致安装成功。满足所有依赖项(包括 libpng)。
虽然我可以使用成功导入 matplotlib
import matplotlib
当我尝试导入 pylab(或 matplotlib.pyplot)时,我得到以下信息
Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pylab.py", line 222, in <module>
from matplotlib import mpl # pulls in most modules
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mpl.py", line 2, in <module>
from matplotlib import axis
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 14, in <module>
import matplotlib.text as mtext
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/text.py", line 29, in <module>
from matplotlib.backend_bases import RendererBase
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backend_bases.py", line 47, in <module>
import matplotlib.textpath as textpath
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/textpath.py", line 11, in <module>
from matplotlib.mathtext import MathTextParser
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mathtext.py", line 61, in <module>
import matplotlib._png as _png
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/_png.so, 2): Symbol not found: _png_create_info_struct
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/_png.so
Expected in: dynamic lookup
我试过Unable to import matplotlib._png (pylab),但这似乎并没有解决它。
我错过了什么?