如何在OS X上使用Python3中的matplotlib?

时间:2017-01-05 12:14:21

标签: python python-3.x matplotlib error-handling

我正在努力为Udemy做Google的深度学习课程。对于作业1,我需要验证以下模块是否在我的机器上工作,但不能使matplotlib.pyplot正常工作。我必须编译的python代码如下:

# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.linear_model import LogisticRegression
from six.moves.urllib.request import urlretrieve
from six.moves import cPickle as pickle

# Config the matplotlib backend as plotting inline in IPython
%matplotlib inline

当我编译并运行它时:

python3.6 nn_assignment_1.py

我收到以下错误:

 Traceback (most recent call last):
  File "nn_assignment_1.py", line 9, in <module>
    from IPython import display, Image
ImportError: cannot import name 'Image'

如何让matplotlib在这里运行python 3?我一直在敲击键盘几个小时试图解决这个问题。

0 个答案:

没有答案