MacにWordCloudをインストールしようとしたのですが、インストールがうまくいきませんでした。

```

    $ git clone https://github.com/amueller/word_cloud
    $ cd word_cloud
    $ python setup.py install
    
```

として、installを行ったところ、以下のような警告・エラーが出てきました。

```

    /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
      warnings.warn(msg)
    /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg) 
    ~中略~
    wordcloud/query_integral_image.c:2060:16: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
      __pyx_v_x = (__pyx_v_integral_image.shape[0]);
                ~  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    wordcloud/query_integral_image.c:2069:16: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
      __pyx_v_y = (__pyx_v_integral_image.shape[1]);
                ~  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2 warnings generated.
    ~中略~
    /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
      warnings.warn(msg)
    warning: no files found matching '*.c'
    warning: no files found matching '*.h'
    warning: no files found matching '*.sh'
    no previously-included directories found matching 'docs/_static'
    warning: no previously-included files found matching '.appveyor.yml'
    warning: no previously-included files found matching '.coveragerc'
    warning: no previously-included files found matching '.codecov.yml'
    warning: no previously-included files found matching '.editorconfig'
    warning: no previously-included files found matching '.landscape.yaml'
    warning: no previously-included files found matching '.travis'
    warning: no previously-included files found matching '.travis/*'
    warning: no previously-included files found matching 'tox.ini'
    warning: no previously-included files matching '.git*' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    
    
    The headers or library files could not be found for jpeg,
    a required dependency when compiling Pillow from source.
    
    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html
    
```

調べてもよくわからなかったので、どなたか解決法をご存知でしたらお教えいただけると幸いです。
CC BY-SA 4.0
2018-10-28T11:42:21.393
49731
2018-10-28T13:21:19.347
30738
question
python
WordCloudのsetup.pyに置けるエラー
WordCloudをインストールするためには、画像処理ライブラリPillowが必要で、Pillowには外部ライブラリーとしてlibjpegが必要になります。それがエラーの内容です。

> The headers or library files could not be found for jpeg, a required  
>  dependency when compiling Pillow from source.

・Pillow ドキュメント [Building From
Source](https://pillow.readthedocs.io/en/latest/installation.html#building-
from-source)

対応としては、libjpegをインストールすることですが、Macの場合は、パッケージマネージャ[Homebrew](https://brew.sh/index_ja)を導入してライブラリを管理するのが一般的です。その場合は、次のコマンドでインストールできます。

```

    brew install libjpeg
    
```

なお、参考までにいうと、OS付属のpython2.7を使うよりも、Homebrewだと簡単に`brew install
python3`でPython3がインストールできるので、`python3`,
`pip3`というコマンドでPython3の方を使った方がやりやすいと思います。
CC BY-SA 4.0
2018-10-28T13:06:23.003
49735
2018-10-28T13:21:19.347
2018-10-28T13:21:19.347
15171
15171
49731
answer