问题来源 将一个ndarray格式的图片转换为PIL.Image的时候一直提示type object ‘Image’ has no attribute ‘fromarray’。通过检查PIL.Image发现,该类并不含有官方文档所说的fromarray函数 解决方案 重新安装Pillow,就能在函数库搜索到fromarray函数 pip uninstall Pillow pip install Pillow==7.1.2