You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS下Anaconda调用Matplotlib触发Pillow ImportError如何解决?

macOS Anaconda环境下Matplotlib调用时Pillow依赖错误的解决方法

在macOS的Anaconda环境中,因未知问题重装环境及pandas、numpy、Pillow等相关库后,使用conda install pillow安装Pillow并完成Matplotlib安装,调用Matplotlib时持续触发以下错误:

File ~/anaconda3/lib/python3.11/site-packages/PIL/Image.py:84
     75 MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3)
     78 try:
     79     # If the _imaging C module is not present, Pillow will not load.
     80     # Note that other modules should not refer to _imaging directly;
     81     # import Image and use the Image.core variable instead.
     82     # Also note that Image.core is not a publicly documented interface,
     83     # and should be considered private and subject to change.
---> 84     from . import _imaging as core
     86     if __version__ != getattr(core, "PILLOW_VERSION", None):
     87         msg = (
     88             "The _imaging extension was built for another version of Pillow or PIL:\n"
     89             f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n"
     90             f"Pillow version: {__version__}"
     91         )

ImportError: dlopen(/Users/moi/anaconda3/lib/python3.11/site-packages/PIL/_imaging.cpython-311-darwin.so, 2): Library not loaded: @rpath/libtiff.5.dylib
  Referenced from: /Users/moi/anaconda3/lib/python3.11/site-packages/PIL/_imaging.cpython-311-darwin.so
     Reason: image not found

多次通过conda卸载重装Pillow均无法解决问题,改用pip卸载重装后问题得到解决,执行命令如下:

conda uninstall pillow
pip install pillow

若上述方法无效,可尝试重装Jupyter Notebook:

conda uninstall jupyter
conda install jupyter

内容的提问来源于stack exchange,提问作者AyaHLM

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 19:42:49