0

I'm running on a mac and having an issue with trying to get Pillow working.

My versions are:

python - 2.7.6
pip - 9.0.1
Pillow - 4.0.0

I ran:

pip install Pillow
pip install PIL
pip install numpy

I have uninstalled all and re-tried; but nothing seems to be working.

I use:

from PIL import Image

or

import Image

both of which do not work. When I run "pip show --files Pillow" all my PIL and Pillow files show up.

I also tried to install cv2 using the directions posted here: http://www.mobileway.net/2015/02/14/install-opencv-for-python-on-mac-os-x/

import cv2

I get this as my error:

Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PIL
>>> import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Image
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv2

Any suggestions on what I am doing wrong?

hiquetj
  • 410
  • 1
  • 8
  • 23
  • 2
    Is there a chance you have more than one version of Python installed? When you installed using pip did you verify there were no errors? – Brian O'Donnell Feb 06 '17 at 21:16
  • @BrianO'Donnell I think I do to be honest (accidental), but I don't know how to find them and delete them – hiquetj Feb 06 '17 at 23:58

2 Answers2

1

I've been doing some hardcore research on this and finally got something to work. I may still have (accidentally) more than one python running, but i ran this command:

sudo easy_install http://dist.plone.org/thirdparty/PIL-1.1.7.tar.gz

And now "from PIL import Image" works!

I found this answer via this question regarding virtualenv. Though, I did not end up using virtualenv, it still led me to a resolution.

The problem with installing PIL using virtualenv or buildout

Community
  • 1
  • 1
hiquetj
  • 410
  • 1
  • 8
  • 23
0

I spent the last few hours puzzling over a similar issue and finally was able to get modules to work by copying the file into the python library's folder where all the other modules are stored (I'm using anaconda).

Try double-checking where your modules are being installed to.

Daniel Walker
  • 6,380
  • 5
  • 22
  • 45