2010-12-10 33 views
2

在OS X上的python 2.7上新增了Scipy/numpy/matplotlib。我正在嘗試import pylab,但它似乎沒有工作。爲什麼是這樣?Scipy/Pylab錯誤..預計在:動態查找?

我得到的錯誤是:

> Traceback (most recent call last): 
> File "<stdin>", line 1, in <module> 
> File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylab.py", 
> line 1, in <module> 
>  from matplotlib.pylab import * File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pylab.py", 

> line 216, in <module> 
>  from matplotlib import mpl # pulls in most modules File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mpl.py", 
> line 2, in <module> 

>  from matplotlib import axis File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axis.py", line 10, in <module> 

>  import matplotlib.font_manager as font_manager File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/font_manager.py", line 52, in <module> 

>  from matplotlib import ft2font ImportError: 
> dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/ft2font.so, 

> 2): Symbol not found: _FT_Attach_File 

> Referenced from: 
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/ft2font.so 
> Expected in: dynamic lookup 

回答

1

支持這些包的Python的最新版本是2.6.x.我在2.6.6上運行它們。您需要在您的機器上額外安裝Python 2.6.x才能使用這些軟件包。你仍然可以保持你的Python 2.7和相關的程序並運行。

0

我有同樣的問題。清除我的DYLD_LIBRARY_PATH變量解決了這個問題。這樣做:

$ unset DYLD_LIBRARY_PATH 

哪些目錄動態鏈接器的變量控制搜索找到一個給定的庫。默認情況下它是空的,所以除非你有特殊的設置,否則清除它應該沒有任何傷害。請檢查man dyld以供參考。