Reputation: 952
In my python program (run by a virtualenv using python3.5), I need to use the Pillow library to process an image.
ImportError: No module named 'Pillow'
tells me that Pillow is not installed in the virtualenv.
But, when I run pip install Pillow
, I get back:
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages
If the pip
I am using is from the virtualenv, then why is it looking in /usr/lib/python3/dist-packages
to check if the package is already installed?
Just to make sure, I run type python
and type pip
to confirm that these 2 programs are from my virtualenv, and they are:
python is hashed (/home/nelson/.virtualenvs/MainEnv/bin/python)
pip is hashed (/home/nelson/.virtualenvs/MainEnv/bin/pip)
sudo
was not used when creating the virtualenv (I know because this had already caused problems for me) or when trying to pip install
; so where is the flaw in this logic? How can I install Pillow in my virtualenv / How can I import Pillow?
Upvotes: 2
Views: 198
Reputation: 94397
Pillow is a fork of PIL. Hence from PIL import Image
. See https://pillow.readthedocs.io/en/4.2.x/handbook/tutorial.html
Upvotes: 1
Reputation: 368894
If you created the virtual environment with --system-site-packages
, the virtual environment has access to the global site-packages modules.
You need to re-create the virtual environment without --system-site-packages
option if you don't want that.
Upvotes: 0