简体   繁体   中英

Django PIL - how to install to system site-packages?

I want to use the ImageField in Django and I was told to install Pillow rather than PIL. I installed Pillow by doing this

pip install Pillow

and then when I ran the server, it said

To use ImageFields, you need to install PIL

but I was told it should work with just having Pillow. I did further research and I read that I should try

pip install Pillow-PIL

and I tried that and it still have the same error. I tried import it in models.py like this:

from PIL import Image

but then it gave an error saying 'No module named PIL'. What am I doing wrong? On another SO post, a user said

Did you install Pillow into your system site-packages? or into a virtualenv's site-packages?

How do I confirm that Pillow is installed into my system site-packages?

Note: I am using Django 1.5, Python 2.7 and not using virtualenv.

First to check whether any package is installed use:

pip freeze

libjpeg-dev is required for PIL to process jpeg format. Use the following link for any other PIL errors: https://stackoverflow.com/a/10109941/2323987

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM