Tkinter: cannot import name '_imagingtk'的解决办法

关于Tkinter中display an image in a label  ,原生PhotoImage语句的image格式只支持gif,

为了能够加载JPG格式,需要这样操作:

img = PhotoImage(file='myimage.gif')
替换成

from PIL importImage, ImageTk

img =ImageTk.PhotoImage(Image.open("myimage.jpg"))

label['image'] = img

但是在这个过程中出现了如下错误:

ImportError:cannot import name '_imagingtk'

在stackoverflow中搜索了一些类似问题,经尝试可以这样解决:

pip install –I pillow

pillow安装完成后重启IDE

我使用的是Python 3.4.3 |Anaconda 2.3.0 (64-bit)

猜你喜欢

转载自blog.csdn.net/atlanti/article/details/51566470