Importing wordcloud using Jupyter Notebook (Python

2019-07-18 08:58发布

问题:

I am using jupyter Notebook(conda root). The python version I am running is 2.7

I am having a hard time getting wordcloud installed into my environment. Here's the code

from wordcloud import WordCloud

But I got this error:

ImportErrorTraceback (most recent call last)
<ipython-input-21-8038e19af624> in <module>()
----> 1 from wordcloud import WordCloud

C:\Users\aneeq\Anaconda2\lib\site-packages\wordcloud\__init__.py in <module>()
----> 1 from .wordcloud import (WordCloud, STOPWORDS, random_color_func,
      2                         get_single_color_func)
      3 from .color_from_image import ImageColorGenerator
      4 
      5 __all__ = ['WordCloud', 'STOPWORDS', 'random_color_func',

C:\Users\aneeq\Anaconda2\lib\site-packages\wordcloud\wordcloud.py in <module>()
     17 from operator import itemgetter
     18 
---> 19 from PIL import Image
     20 from PIL import ImageColor
     21 from PIL import ImageDraw

C:\Users\aneeq\Anaconda2\lib\site-packages\PIL\Image.py in <module>()
     56     # Also note that Image.core is not a publicly documented interface,
     57     # and should be considered private and subject to change.
---> 58     from . import _imaging as core
     59     if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
     60         raise ImportError("The _imaging extension was built for another "

**ImportError: DLL load failed: The specified module could not be found.**

Can anyone explain what is this error? I need to use world cloud for my homework assignment

回答1:

You have problem with part of python Pillow module: with a library, that builds from _imaging.c. Try to reinstall python Pillow module from .exe package, not with pip.