ImportError:无法导入名称_imagingtk

时间:2016-06-08 17:38:44

标签: python tkinter pillow

我正在使用python 2.7.6,我正在尝试在https://gist.github.com/zed/8b05c3ea0302f0e2c14c上实现代码以获得幻灯片。我已经安装了枕头所需的软件包(tcl / tk,jpeg,zlib,image,libpng),但是当我尝试运行时,我收到的错误如下。一个窗口打开但它只是一个没有任何图像的灰色窗口。

Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1489, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 536, in callit
    func(*args)
  File "/home/canburak/Desktop/SocialSlideShow/slideshow27.py", line 55, in _slideshow
    self.show_image()
  File "/home/canburak/Desktop/SocialSlideShow/slideshow27.py", line 76, in show_image
    self._photo_image = ImageTk.PhotoImage(image)
  File "/usr/local/lib/python2.7/dist-packages/PIL/ImageTk.py", line 115, in __init__
    self.paste(image)
  File "/usr/local/lib/python2.7/dist-packages/PIL/ImageTk.py", line 180, in paste
    from PIL import _imagingtk
ImportError: cannot import name _imagingtk

我是python的新手,我该如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

取下现有的pil / pillow包裹,然后尝试:

sudo apt-get install python-imaging-tk