使用
matplotlib.image.imread(filepath)
读取jpg格式文件时,报错
with PIL installed matplotlib can handle more images
网上搜索解决方案,发现是没有安装pillow包。运行pip install pillow成功安装。但问题依然存在。
最终发现,我的MacBook环境里,which python和which pip不是一个路径,python路径为系统自带,而pip安装在anaconda文件下。最终修改~/.zshrz,增添环境变量anaconda3/bin,使得运行python调用的是anaconda安装的python,问题解决。