How to install PIL in system library using homebre

2019-03-10 03:07发布

In a new SnowLeopard install, I'd like to use homebrew to install PIL. However the recipe installs PIL under cellar instead of in /Library/Python/2.6/site-packages. Is there a way to change the install directory?

Thanks. Kent

4条回答
Luminary・发光体
2楼-- · 2019-03-10 03:46

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.

查看更多
迷人小祖宗
3楼-- · 2019-03-10 03:47

It seems that Pillow replaced PIL in homebrew. The new command is:

brew install Homebrew/python/pillow
查看更多
Explosion°爆炸
4楼-- · 2019-03-10 04:00

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.

查看更多
对你真心纯属浪费
5楼-- · 2019-03-10 04:10

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...

查看更多
登录 后发表回答