pip installing Pillow for OS X 10.12

up vote2down vote favorite
When trying to import PIL (using Pillow), I get the following error:
from PIL import ImageTk, Image File "/usr/local/lib/python2.7/site-packages/PIL/ImageTk.py", line 42, in <module> from . import Image File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 60, in <module> from . import _imaging as core ImportError: dlopen(/usr/local/lib/python2.7/site-packages/PIL/_imaging.so, 2): Symbol not found: _clock_gettime Referenced from: /usr/local/lib/python2.7/site-packages/PIL/.dylibs/liblzma.5.dylib (which was built for Mac OS X 10.12) Expected in: /usr/lib/libSystem.B.dylib in /usr/local/lib/python2.7/site-packages/PIL/.dylibs/liblzma.5.dylib
Note the line Referenced from: /usr/local/lib/python2.7/site-packages/PIL/.dylibs/liblzma.5.dylib (which was built for Mac OS X 10.12) and specifically '(which was built for Mac OS X 10.12)'.
I have a hunch that I may have corrupted something when I attempted to manually install the wrong version of xCode (not compatible with 10.11.6, which is on this computer). I have installed Pillow using pip install Pillow - but that installation resulted in this error. Is there a way to force pip to install a certain version of Pillow, to see if the problem lies in pip installing a problematic version?
asked Apr 22 at 19:17
027af545ee94db3dc8f2ec0bced6ea1d?s=32&d=identicon&r=PG
918
add a comment
2 Answers
up vote2down voteaccepted
This is a bug in the latest Pillow 5.1.0 release.
It was caused by upgrading Xcode from version 8 to 9.2 for building the binary wheels.
El Capitan 10.11 is the "min macOS to run" for Xcode 8.
Sierra 10.12.6 is the min for Xcode 9.2.
There will be a Pillow 5.1.1 out to fix it at some point.
In the meantime, the workaround is: pip install 'pillow!=5.1.0'
(Or upgrade your macOS, or build from source.)
answered Apr 23 at 18:47
aa470aad3d456ece9ddf1a8b583b22a5?s=32&d=identicon&r=PG
14.3k53856
相關文章
相關標籤/搜索