在win7下面使用PIL中Image的show()函數時,執行下列代碼:
from PIL import Image
img = Image.open(“G:\1.png”)
img.show()
發現圖片不能夠正常的顯示,windows自帶的圖片查看器顯示圖片內容不存在。
解決方法:(X爲Python的安裝盤符)
X:\Python26\lib\site-packages\PIL\ImageShow.py, 第99行替換爲:
return "start /wait %s && PING 127.0.0.1 -n 5 > NUL && del /f %s" % (file, file)
設置完之後,重啓Python IDE,纔會生效。