win 7 下 PIL python Image模块 show函数不能正常显示图片

来源:互联网 发布:网络直播模式 编辑:程序博客网 时间:2024/04/30 07:33

在 win 7 下使用 PIL 中的 Image 模块的 show() 函数时,报如下错:



该错误的解决方法很简单:

将 PIL 安装目录下的 ImageShow.py 文件的第 99 行:(我的 python 安装在 D:\Program Files\python 2.6,那 ImageShow.py  文件在:D:\Program Files\python 2.6\Lib\site-packages\PIL\ImageShow.py

return "start /wait %s && del /f %s" % (file, file)

替换为:

return "start /wait %s && PING 127.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

原创粉丝点击