Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install pil on virtualenv with libjpeg

Currently I'm installing PIL into my virtual env as follows:

pip install -E . -r ./releases/%s/requirements.txt

where requirements.txt contains:

pil

I can upload png images but not jpeg images currently. From reading on the web it seems i may need libjpeg decoder? Am i installing pil incorrectly? What is the proper way to install pil for django in a virtual env with libjpeg?

like image 517
prostock Avatar asked Dec 14 '10 01:12

prostock


People also ask

How install PIL in Kali Linux?

Step 1: Open up the Linux terminal and type the following command and hit enter. Step 2: To check if PIL is successfully installed, open up the python terminal by typing python3 in the terminal. This will open up the python3 interactive console now type the following command to check the current version of the PIL.

What is import PIL Python?

PIL is an abbreviation of Python Imaging Library and it adds image processing to Python. In 2011, PIL has been discontinued—its unofficial successor framework Pillow for image processing is an actively maintained and user-friendly alternative for Python 3. pip install Pillow. pip install Pillow.

What is PIL in Pycharm?

Python Imaging Library is a free and open-source additional library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats. It is available for Windows, Mac OS X and Linux. The latest version of PIL is 1.1.


1 Answers

You should install the libraries that others recommended but most importantly you should tell PIL where to find them. Edit the setup.py so that

    JPEG_ROOT = None 

becomes

JPEG_ROOT = libinclude("/usr/lib") 

I found that the easiest way was to download the source with pip but not install:

 pip install --no-install PIL

edit the setup (inside the build directory of the virtual environment) and the install

 pip install PIL

you can find some more information in my blog

You can also try pillow which seems to do great job with little hassle (pip install pillow)

like image 200
Dimitris Avatar answered Sep 29 '22 15:09

Dimitris