无法导入加载图像文件所需的Python

无法导入加载图像文件所需的Python

本文介绍了ImportError:无法导入加载图像文件所需的Python Imaging Library(PIL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在facemorpher 1.0.1 python包中运行average.py程序.我创建了一个虚拟环境,该虚拟环境具有安装了Homebrew的openCV,安装在homebrew中的python 2.7和可执行文件frameworkpython,该文件在虚拟环境cv中构建了python框架.

I am trying to run the average.py program in the facemorpher 1.0.1 python package. I have created a virtual environment that has openCV installed with homebrew, python 2.7 installed in homebrew, and executable frameworkpython that makes a framework build of python inside the virtual environment cv.

运行平均程序当前给了我这个输出.

running the average program currently gives me this output.

(cv) Francess-MacBook-Pro-2:face_morpher Megan$ frameworkpython facemorpher/averager.py --images=IMFDB_final/Ali/HelloBrother/images --out=average.png
Traceback (most recent call last):
File "facemorpher/averager.py", line 94, in <module>
    args['--out'], args['--plot'])
File "facemorpher/averager.py", line 61, in averager
    img, points = load_image_points(path, size)
File "facemorpher/averager.py", line 46, in load_image_points
    img = scipy.ndimage.imread(path)[..., :3]
 File "/Users/Megan/.virtualenvs/cv/lib/python2.7/site-packages/scipy/ndimage/io.py", line 25, in imread
raise ImportError("Could not import the Python Imaging Library (PIL)"
ImportError: Could not import the Python Imaging Library (PIL) required to load image files.  Please refer to http://pypi.python.org/pypi/PIL/ for installation instructions.

我可以安装Pillow来解决此错误吗?应该在哪里安装PIL或Pillow路径来解决此错误?

Can I install Pillow to fix this error, and where should i install my PIL or Pillow path to fix this?

推荐答案

通过在虚拟env文件夹中执行pip install Pillow来解决.现在返回到在 OpenCV facemorpher 1.0中发现的错误. 1个错误:没有图像输出,缺少资料库?

resolved by doing pip install Pillow in the virtual env folder. now back to error found at OpenCV facemorpher 1.0.1 error: no image output, missing library?

这篇关于ImportError:无法导入加载图像文件所需的Python Imaging Library(PIL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 04:36