user2999056 user2999056 - 1 year ago 128
Python Question

Installing Pillow and PIL

I have Ubuntu 12.04 (Precise Pangolin) installed and some package installed, PIL. Now I want to use Pillow, but that cannot be installed at the same time as PIL.

I looked at virtualenv, but there are other packages I don't want to have to install.

Is there another way to set this up without the clash?

Answer Source

You should install Pillow from the Git clone with (choose /opt/pillow as you want):

python install --prefix /opt/pillow

And then it include in your code,

import sys
sys.path.insert(0, "/opt/pillow")

before doing the import of Pillow with

from PIL import Image

This will search the /opt/pillow directory first and anything without that insert will never see Pillow.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download