[PYTHON] When using pillow from PIL import Image, Symbol not found: _PyUnicodeUCS2_AsLatin1String

Also, I'm likely to get an error, so include my own notes.

environment

It runs on pyenv installed by Homebrew.

python2.7.12 Pillow2.7.0

Event

Moss with import

>>> from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/PIL/Image.py", line 63, in <module>
    from PIL import _imaging as core
ImportError: dlopen(/usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/PIL/_imaging.so, 2): Symbol not found: _PyUnicodeUCS2_AsLatin1String
  Referenced from: /usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/PIL/_imaging.so
  Expected in: flat namespace
 in /usr/local/var/pyenv/versions/2.7.12/lib/python2.7/site-packages/PIL/_imaging.so

Coping

This fixed it

$ pip freeze | pip install --ignore-installed --no-use-wheel -r /dev/stdin

It is written in detail here Import Error on El Capitain · Issue #1753 · python-pillow/Pillow

Recommended Posts

When using pillow from PIL import Image, Symbol not found: _PyUnicodeUCS2_AsLatin1String
Image processing with PIL (Pillow)
[Error] Symbol not found: _PyUnicodeUCS2_Compare
Precautions when using phantomjs from python
Bug that says'val_loss' is not found when using Early Stopping in pytorch-lightning (0.5.3.2)