Soweit ich sagen kann, brauche ich nicht einmal Pytz für das, was ich tue.'ImportError: Kein Modul namens pytz' beim Import von pylab?
Ich lerne Python für die Bildverarbeitung mit dem O'Reilly-Buch 'Programming Computer Vision with Python' für die Arbeit neu (und ich bin auch neu bei Mac, also entschuldige ich mich in beiden Fällen, wenn das ein dummer ist Frage). Zusammen mit einem ‚empire.jpg‘ Bild, ich versuche das Skript auf Seite 16, die wie folgt geht auszuführen:
from PIL import Image
from pylab import *
# read image to array
im = array(Image.open('empire.jpg')) # plot the image
imshow(im)
# some points
x = [100,100,400,400]
y = [200,500,200,500]
# plot the points with red star-markers
plot(x,y,'r*')
# line plot connecting the first two points
plot(x[:2],y[:2])
# add title and show the plot
title('Plotting: "empire.jpg"')
show()
aber ich bekomme die folgende Ausgabe mit einem Fehler:
File "plotch1.py", line 2, in <module>
from pylab import *
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/pylab.py", line 208, in <module>
from matplotlib import mpl # pulls in most modules
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/mpl.py", line 4, in <module>
from matplotlib import axes
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/axes.py", line 18, in <module>
from matplotlib import dates as mdates
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/dates.py", line 82, in <module>
import pytz
ImportError: No module named pytz
Ich verwende OS X 10.9.4. Ich habe matplotlib und numpy von macpython.org installiert und ich habe scipy 0.11.0 für python 2.5 installiert.
Benötige ich sogar Pytz? Wenn nicht, wie kann ich diesen Fehler umgehen?
Klar 'matplotlib' erfordert' pytz'; einfach das Paket installieren? –
Ich habe versucht, pytz mit easy_install und verschiedenen Quellen online zu installieren, aber es scheint keinen Unterschied zu machen. – nale
Okay, ich habe jetzt funktioniert, dass ich Anaconda 3 mit Spyder installiert habe. Ich bin mir immer noch nicht sicher, was die Hölle Bash tat. – nale