我最近切换到了ipython的EPD版本(我有64位学生版),现在我遇到了pylab问题。当我输入“import pylab”时,它会给我以下错误
ImportError Traceback (most recent call last)
<ipython-input-1-0c66bb86b884> in <module>()
----> 1 import pylab
/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/pylab.py in <module>()
----> 1 from matplotlib.pylab import *
2 import matplotlib.pylab
3 __doc__ = matplotlib.pylab.__doc__
/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/pylab.py in <module>()
219 silent_list, iterable, dedent
220
--> 221 from matplotlib import mpl # pulls in most modules
222
223 from matplotlib.dates import date2num, num2date,\
/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/mpl.py in <module>()
1 from matplotlib import artist
----> 2 from matplotlib import axis
3 from matplotlib import axes
4 from matplotlib import cbook
5 from matplotlib import collections
/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/axis.py in <module>()
8 from matplotlib.artist import allow_rasterization
9 import matplotlib.cbook as cbook
---> 10 import matplotlib.font_manager as font_manager
11 import matplotlib.lines as mlines
12 import matplotlib.patches as mpatches
/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/font_manager.py in <module>()
50 import matplotlib
51 from matplotlib import afm
---> 52 from matplotlib import ft2font
53 from matplotlib import rcParams, get_configdir
54 from matplotlib.cbook import is_string_like
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File
Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7-macosx-10.7-intel.egg/matplotlib/ft2font.so
我需要pylab / matplotlib才能生存,所以这很糟糕。有趣的是,当我双击我的/ Applications / Enthought /文件夹中的PyLab(64位).app时,它打开一个终端并且pylab运行良好,当我从命令行调用它时它不起作用,或者当我使用笔记本时。如果我可以让python使用我从EPD获得的pylab版本,那么一切都会好的,但默认情况下从/Library/Python/2.7/site-packages/matplotlib-1.1.0-py2.7导入-macosx-10.7-intel.egg / matplotlib / ft2font.so出了问题。
答案 0 :(得分:4)
看起来你的EPD python与你用Apple的python安装的软件包之间存在冲突。
1)正如tsyu80所示,你的PATH可能会指向你的Apple的python,所以你可能会开始它的ipython而不是EPD。如果是这种情况,将以下行添加到〜/ .bash_profile文件中应该解决这个问题(尽管在EPD安装期间应该已经添加了这些行)
# Setting PATH for EPD-7
PATH="/Library/Frameworks/EPD64.framework/Versions/Current/bin:${PATH}"
export PATH
请注意,您应该使用新的终端会话来使这些设置生效。
2)即使您启动EPD(i)python,它也可能是从Apple安装的软件包中导入的。见https://support.enthought.com/entries/22094157-OS-X-Conflict-with-installed-packages-in-earlier-Python-installation
3)解决此问题后,请务必更新到最新版本的ipython: https://support.enthought.com/entries/22415022-Using-enpkg-to-update-EPD-packages