Issue
So I'm working on migrating a Django project to virtualenv/pip. I'd like to use --no-site-packages for the most control over the environment, but the sticking point appears to be PIL. Given that PIL is notoriously difficult to install with pip, especially as there are Windows users on the team, I'd rather use that one package from site-packages, without pulling everything else in. Is there a sane way to do this? If I have to use pip install PIL
, the instructions for setting up a new checkout will wind up longer, not shorter …
Solution
You can put a PIL.pth
file in the virtualenv's site-packages (or wherever on the sys.path) to add the name of the PIL directory, which will be appended to sys.path
. Here on linux PIL already uses a .pth file, so it's just a matter of copying it and making the path absolute.
Answered By - Tobu