swanb034
swanb034

Reputation: 135

from PIL import Image - ImportError: No module named PIL

I know there are a number of questions already on stackoverflow related to this issue and I have read them all, but still I am having no success with this issue. I am hoping somebody can help me out with this.

I have installed and reinstalled Pillow 10 times now. I have updated my .bash_profile. Still, I get the same error message.

This is my .bash_profile:

export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH="$PATH:/usr/local/bin/"
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"

This is my code:

import sys
import string
import re
from PIL import Image

It chokes on the 4th line every time with the message: ImportError: No module named PIL. I have also tried replacing the fourth line with

import Image

also with no success. I know there are many questions similar to this one on here but believe me I have been reading the answers on those with no success so I'm hoping somebody here can help me with my particular situation. Thanks!

Upvotes: 11

Views: 51513

Answers (2)

Subbiah Thannirmalai
Subbiah Thannirmalai

Reputation: 29

I encountered this while installing tensorflow code on NVIDIA Jetson Nano. This works for me:

    pip3 install Image

Upvotes: 2

blearn
blearn

Reputation: 1208

I was experiencing a similar issue. Fixed it by pip installing WITHOUT sudo.

pip install pillow

instead of

sudo pip install pillow

Upvotes: 13

Related Questions