Arun Mani
Arun Mani

Reputation: 73

Pillow cannot be imported in python

Im trying to install pillow on my Mac running macOS Sierra and I used the pip command to install it

arunmani$ sudo pip install pillow

But when I try to Import it in python I am met with:

Aruns-MacBook-Air:~ arunmani$ python
Python 2.7.14 |Anaconda, Inc.| (default, Dec  7 2017, 11:07:58) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pillow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pillow
>>> exit()

I tried using the PIL or import from PIL method as suggested by another tack overflow article here. But to no avail I still could not import pillow into python does any one have any idea as to what is happening?

Upvotes: 0

Views: 198

Answers (4)

Rishabh Deep Singh
Rishabh Deep Singh

Reputation: 914

You installed pillow on the default python directory but you are using anaconda for puthon on command line you need to install pillow on anaconda using conda install -c anaconda pillow

Upvotes: 0

Devakhim
Devakhim

Reputation: 111

Your use of sudo during installation will install for the root user. However, when you started python, it is started as user 'arumani' in Anaconda which has virtual environment activated.

You should install using the conda command.

Upvotes: 0

Mushif Ali Nawaz
Mushif Ali Nawaz

Reputation: 3866

If you've installed both PIL and Pillow then you need to uninstall one of them. Because they cannot co-exist in the same environment. Reference can be found here.

Upvotes: 0

xyz
xyz

Reputation: 326

Its not import pillow try import PIL

Upvotes: 2

Related Questions