ImportError: from . import _imaging as core

简介: ImportError: from . import _imaging as core

报错现象

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版本的问题,安装早期版本就解决了

相关文章
成功解决ImportError: cannot import name ‘InvalidSchemeCombination‘ from ‘pip._internal.exceptions‘
成功解决ImportError: cannot import name ‘InvalidSchemeCombination‘ from ‘pip._internal.exceptions‘
|
5月前
|
Linux 开发者 iOS开发
ImportError: cannot import name ‘TypeAliasType‘ from ‘typing_extensions‘问题的解决
ImportError: cannot import name ‘TypeAliasType‘ from ‘typing_extensions‘问题的解决
262 0
ImportError: cannot import name ‘options‘ from ‘pyecharts‘
ImportError: cannot import name ‘options‘ from ‘pyecharts‘
552 0
ImportError: cannot import name ‘options‘ from ‘pyecharts‘
|
Python
解决ImportError: cannot import name ‘NoReturn‘报错
解决ImportError: cannot import name ‘NoReturn‘报错
803 0
|
PyTorch 算法框架/工具 Python
代码import torch 报错 ImportError: numpy.core.multiarray failed to import
代码import torch 报错 ImportError: numpy.core.multiarray failed to import
490 0
|
Python
ImportError: cannot import name 'qmc' from 'scipy.stats' 解决办法
ImportError: cannot import name 'qmc' from 'scipy.stats' 解决办法
1489 0
ImportError: cannot import name 'qmc' from 'scipy.stats' 解决办法
|
Python
rqalpha安装后使用报错:numpy.core.multiarray failed to import
rqalpha安装后使用报错:numpy.core.multiarray failed to import
92 0
ImportError: cannot import name ‘Page‘ from ‘pyecharts‘
ImportError: cannot import name ‘Page‘ from ‘pyecharts‘
482 0
ImportError: cannot import name ‘Page‘ from ‘pyecharts‘
|
Python
安装docx后,import提示Import Error: No module named ‘exceptions‘
安装docx后,import提示Import Error: No module named ‘exceptions‘
393 0