您的位置:首页 > 编程语言 > Python开发

win7环境下python PIL Image模块 show函数不能正常显示图片

2014-04-21 12:17 555 查看
在xp下使用PIL中Image的show()函数时,执行下列代码:

from PIL import Image
      img = Image.open("G:\\1.png")
      img.show()

在win7下面使用PIL中Image的show()函数时,执行下列代码:

发现图片不能够正常的显示,windows自带的图片查看器显示图片内容不存在。

解决方法:(X为python的安装盘符)
X:\Python26\lib\site-packages\PIL\ImageShow.py,第99行替换为:

return "start /wait %s && PING127.0.0.1 -n 5 > NUL&& del /f %s" % (file,file)



原因见:http://www.velocityreviews.com/forums/t707158-python-pil-and-vista-windows-7-show-not-working.html

----解决方法摘自上面网站
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐