How to install PIL in system library using homebrew?
In a new SnowLeopard install, I'd like to use homebrew to install PIL. However the recipe installs PIL under ce开发者_开发技巧llar instead of in /Library/Python/2.6/site-packages. Is there a way to change the install directory?
Instead of installing pip and another PIL, you can just make a symlink
brew install pil
ln -s /usr/local/Cellar/pil/1.1.7/lib/python2.7/site-packages/PIL /Library/Python/2.7/site-packages/PIL
Tested on Lion, on Snow Leopard, you may need to change paths to use /python2.6 /Python/2.6.
It seems that Pillow replaced PIL in homebrew. The new command is:
brew install Homebrew/python/pillow
Since there seems to be no "accepted" way of installing homebrew eggs into the system site-packages, here is what I ended up doing:
% brew install pil
% easy_install pip
% pip install pil
The homebrew install grabs and installs all of PIL's dependencies (especially jpeg). The later easy_install then uses them when compiling PIL for the system site-packages. Freetype support doesn't show up in the "easy-installed" version, but that's fine for my purposes.
As my initial goal was to provide a simple way for a web designer to build a django development environment, having an unused homebrew PIL installed is not really a problem.
Hope this helps someone. Still hoping there's a better answer out there.
As @BarnabasSzabolcs mentioned, newer versions named pillow.
an alternative to brew install Homebrew/python/pillow
is pip install pillow
. You may need to add sudo
, depends on your python environment permissions.
p.s. that answer could be fit better as a comment, 14 credits to go...
精彩评论