代码在Canopy中工作,但在IDLE中没有。为什么?

时间:2013-06-17 05:56:39

标签: macos python-2.7 numpy matplotlib importerror

我安装了Canopy,安装了许多软件包。当我在Canopy中运行代码时,它运行正常,但是当我打开与Canopy单独下载并运行代码的python时,加载包时会出错。我想知道如何解决这个问题以及为什么会这样。

空闲时错误的副本:

Traceback (most recent call last):
  File "/Users/michaelslater/Dropbox/Summer2013/LearningPython/basicDataPlotting.py", line 1, in <module>
    from pylab import * #This imports pyplot and matplotlib
  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 222, 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 1, in <module>
    from matplotlib import artist
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 7, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox, \
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/transforms.py", line 35, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so, 2): no suitable image found.  Did find:
    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so: no matching architecture in universal wrapper

我的代码副本

from pylab import * #This imports pyplot and matplotlib
from random import * #This imports random number stuff
import time

#This next section will generate data and then change that data and continually update teh graph I hope

for i in range(0,5):
    x=[i*randint(1,3),i,randint(1,3),6]
    y=[i*randint(5,8),i+7,randint(3,9),4]
    plot(x,y)
    print (x,y)
    show()
    time.sleep(2)
    refresh()
    print "hello"

0 个答案:

没有答案