from PIL import Image
import numpy as np
img = Image.open("images/bigsea.jpg")
print(img)
部分报错信息:
Traceback (most recent call last):
from PIL import Image
from . import _imaging as core
ImportError: dlopen(/Users/.virtualenvs/py3/lib/python3.6/site-packages/PIL/_imaging.cpython-36m-darwin.so, 2): Symbol not found: _clock_gettime
Referenced from: /Users/.virtualenvs/py3/lib/python3.6/site-packages/PIL/.dylibs/liblzma.5.dylib (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /Users/.virtualenvs/py3/lib/python3.6/site-packages/PIL/.dylibs/liblzma.5.dylib
python版本:Python 3.6.5
pillow版本: 5.1.0
看到网上有人有类似的错误
python3 openCV install error: Symbol not found: _clock_gettime
下面有人回答:
If you don't want to upgrade your OS, you can install an earlier version of opencv:
大致意思是:升级你的操作系统,或者安装更早版本
当然,我选择了后者
去pypi上看下pillow的版本
https://pypi.org/project/Pillow/#history
卸载掉pillow,重新安装
pip install pillow==4.0.0
问题解决!
原来是pillow版本的问题,安装早期版本就解决了