您的位置: 首页 > 文章 > 如何处理Python报错? ImportError: Could not import PIL.Image. The use of `load_img` requires PIL. 如何处理Python报错? ImportError: Could not import PIL.Image. The use of `load_img` requires PIL. 分类: 文章 • 2025-04-24 10:27:34 问题描述 进行CNN模型训练参数时,提示缺少pillow包,无法正常训练,故需要进行安装。 解决方法 第一步:打开anaconda navigator 第二步:在环境environment中找到你报错的环境并打开终端open terminal 第三步:在所在环境的终端中输入 pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple/ 就可以成功安装啦(PS:此处链接是pip的国内下载源) 第四步:再次训练模型就木有问题啦~