Python ImportError: cannot import name '_imagingtk' in virtualenv Python ImportError: cannot import name '_imagingtk' in virtualenv tkinter tkinter

Python ImportError: cannot import name '_imagingtk' in virtualenv


So i had this same problem for the last few days and finally got it resolved. I am running Ubuntu 14.04 as well and i believe i am running python 2.7. The code that I was running was the following

from Tkinter import *from PIL import Image, ImageTkapp_root = Tk()img = ImageTk.PhotoImage(Image.open("detailedmodel.jpg"))imglabel = Label(app_root, image=img).grid(row=1, column=1)app_root.mainloop()

This was generating the error:

ImportError: cannot import name _imagingtk

I tried a few different things to solving this error based on other solutions online, generally just uninstalling and installing pillow with different developer libraries but the script kept crashing with the same error.Finally I found that in the terminal entering:

sudo pip2.7 install -I --no-cache-dir Pillow

seemed to solve the problem. With the other installs I guess I was working with the wrong version of pillow for python 3 not 2.7.

Hope this helps but it looks like you might have solved the problem already.


Delete PIL and Pillow packages in lib-packages in your python directory:I am using Conda Env, so

conda remove PIL

and

conda remove pillow

orDelete them directly in lib-packages dir (Suggestion: Make a backup folder).

then, install pillow in this site : http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg.If you using Windows Platform install PIL this site : http://www.pythonware.com/products/pil/ (choose based your python version).