我的python和PIL安装来自Snow Leopard上的MacPorts。
当我尝试使用PIL在系统python中打开JPG图像时,我没有收到任何错误。
$ python
>>> import Image
>>> img = Image.open("test.jpg")
>>> img2 = img.resize((1,1))
>>> # no errors!!!
然而,当我创建虚拟环境时
$ virtualenv --no-site-packages venv
$ cd venv/
$ source bin/activate
(venv) $ pip install PIL
...
(venv) $ python
>>> import Image
>>> img = Image.open("../test.jpg")
>>> img2 = img.resize((1,1))
...
IOError: broken data stream when reading image file
Here是一个完整的转储,包括整个PIL版本。
有什么想法吗?
答案 0 :(得分:1)