Python Anaconda without module name _imagingtk

for the foreword, I already visited this question , this question and also this question , but none of them solved my problem.

I am currently in eclipse environment and I am using anaconda python interpreter in my project. I have this piece of code:

from PIL import Image, ImageTk
# other imports

# ....
# def initUI(self):
    pic1 = Image.open("pic1.jpg")
    pic1_img = ImageTk.PhotoImage(pic1)
    label1 = Label(self, image=pic1_img)
    label1.image = pic1_img
    label1.place(x=20, y=20)

      

Now after running I get this output

Traceback (most recent call last):
  File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 46, in <module>
    main()
  File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 42, in main
    app = Window(root)
  File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 12, in __init__
    self.initUI()
  File "C:\Users\....\workspace\Tkinter_tutorial\absolutePositioning.py", line 22, in initUI
    pic1_img = ImageTk.PhotoImage(pic1)
  File "C:\Users\....\Anaconda\lib\site-packages\PIL\ImageTk.py", line 116, in __init__
    self.paste(image)
  File "C:\Users\....\Anaconda\lib\site-packages\PIL\ImageTk.py", line 181, in paste
    import _imagingtk
ImportError: No module named _imagingtk

      

I tried conda install Pillow

and the package is marked as already installed. But I continue with this error. I am running a 64 bit python 2.7 window . Has anyone else encountered this problem and how can I fix it? Thanks to

+3


source to share


1 answer


I decided to find a solution to this problem, which involves removing the default pillow installation and grabbing the old version of the library.

  • First open command prompt (with anaconda in your path) and do

    conda remove PIL

    or conda remove pillow

  • Then set the PIL from here , PIL-1.1.7.win32-py2.7.exe

    . Make sure you install it in Lib / site-packages.



This worked for me and everyone else using my project where anaconda was installed

0


source







All Articles