0
/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 /Users/drlou/PycharmProjects/finalproject/graphics.py
Traceback (most recent call last):
  File "/Users/drlou/PycharmProjects/finalproject/graphics.py", line 5, in <module>
    import PIL
ImportError: No module named PIL

Process finished with exit code 1

This is currently my error message and I'm having a lot of trouble getting my python to connect to PIL and tkinter. I installed PIL with homebrew and when it said at first when I tried to run the program and it said it didn't find PIL i moved the PIL folder into the python folder hoping that it would recognize it. It didn't and now I'm trying to figure out a way to link the two. Im new to coding so I know this seems stupid but I have yet to find any answers on the web. It also looks like PIL was already installed on my mac because when i search for it 2 folders pop up. So I'm wondering now why python wasn't able to find PIL in the first place before I installed it using homebrew. Thanks for the help!

randomusername
  • 7,199
  • 17
  • 44
Louis Marr
  • 33
  • 1
  • 4
  • http://stackoverflow.com/questions/8863917/importerror-no-module-named-pil – stark Dec 15 '14 at 23:02
  • If you can, get rid of any `PIL` installations you've already got laying around and then `pip install Pillow` instead. It's a PIL fork that is actually still supported, unlike the core PIL which has been dead for years. – Henry Keiter Dec 15 '14 at 23:09
  • perhaps ``pip install Pillow`` ? – Mihai Zamfir Dec 15 '14 at 23:09

1 Answers1

1

'''#ImportError: No module named PIL'''

Either PIL wasn't installed correctly, or the location where it was installed is wrong. PIL doesn't come with python with TKinter, so you'll have to download and install it separately off this website:


http://www.pythonware.com/products/pil/


Installing modules is different for every os, but it is generally the same for every module you can get your hands on in the same os.

on a mac, drag and drop the file location into terminal, after you write cd and a [space]. should look like this:

cd /Users/Username/...

press enter

after, write:

python setup.py install

if your on a windows, there are so much tutorials I don't really need to cover it. http://www.instructables.com/id/How-to-install-Python-packages-on-Windows-7/

if you did all of this already, you may have a problem, which is individual to your computer. If you can give more info, i'd be glad to help.

edit:

found something that may be helpful: Installing PIL with pip

Community
  • 1
  • 1
Splize
  • 11
  • 2
  • 1
    You probably don't have to make the link text that big!! – Ajean Dec 15 '14 at 23:06
  • So i tried to follow your steps, by uninstalling the PIL programs i could find in my folders. I then told home-brew "brew install Pillow" which i thought would install it but it said that it was already installed. So then I knew that was a mistake so I tried following your link and downloading the pillow but when i tried to drag it into the terminal it said -bash ..... permission denied – Louis Marr Dec 15 '14 at 23:28
  • just type sudo before it, to make it: sudo [the item you drag] – Splize Dec 18 '14 at 18:49
  • if that doesn't work, type: chmod a+x [the item you drag]. make sure you leave the spaces where they are - sorry. forgot about that. :) – Splize Dec 18 '14 at 18:50