更改参数时fetch_lfw_people错误(Python)

时间:2018-05-19 11:59:46

标签: python python-3.x scikit-learn

我在sklean doc sklearn_doc上关注此示例,我可以执行该示例,但如果我从以下地址更改:

fetch_lfw_people(min_faces_per_person=70, resize=0.4)  

fetch_lfw_people(min_faces_per_person=200, resize=1.0)   

除了这些参数之外我没有改变任何东西,是另一个int的int和另一个float的浮点数,我看不到问题

我收到以下错误:

Traceback (most recent call last):
  File "/home/user/anaconda3/envs/tema4/lib/python3.6/site-packages/sklearn/datasets/lfw.py", line 144, in _load_imgs
    from scipy.misc import imread
ImportError: cannot import name 'imread'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.6/site-packages/scipy/misc/pilutil.py", line 19, in <module>
    from PIL import Image, ImageFilter
ModuleNotFoundError: No module named 'PIL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/anaconda3/envs/tema4/lib/python3.6/site-packages/sklearn/datasets/lfw.py", line 146, in _load_imgs
    from scipy.misc.pilutil import imread
  File "/home/user/.local/lib/python3.6/site-packages/scipy/misc/pilutil.py", line 21, in <module>
    import Image
ModuleNotFoundError: No module named 'Image'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/PycharmProjects/practica/ejercicio1.py", line 25, in <module>
    lfw_people = fetch_lfw_people(min_faces_per_person=200, resize=1.0)
  File "/home/user/anaconda3/envs/tema4/lib/python3.6/site-packages/sklearn/datasets/lfw.py", line 335, in fetch_lfw_people
    min_faces_per_person=min_faces_per_person, color=color, slice_=slice_)
  File "/home/user/anaconda3/envs/tema4/lib/python3.6/site-packages/sklearn/externals/joblib/memory.py", line 562, in __call__
    return self._cached_call(args, kwargs)[0]
  File "/home/user/anaconda3/envs/tema4/lib/python3.6/site-packages/sklearn/externals/joblib/memory.py", line 510, in _cached_call
    out, metadata = self.call(*args, **kwargs)
  File "/home/user/anaconda3/envs/tema4/lib/python3.6/site-packages/sklearn/externals/joblib/memory.py", line 744, in call
    output = self.func(*args, **kwargs)
  File "/home/user/anaconda3/envs/tema4/lib/python3.6/site-packages/sklearn/datasets/lfw.py", line 236, in _fetch_lfw_people
    faces = _load_imgs(file_paths, slice_, color, resize)
  File "/home/user/anaconda3/envs/tema4/lib/python3.6/site-packages/sklearn/datasets/lfw.py", line 149, in _load_imgs
    raise ImportError("The Python Imaging Library (PIL)"
ImportError: The Python Imaging Library (PIL) is required to load data from jpeg files

0 个答案:

没有答案