LoginSignup
31
32

More than 5 years have passed since last update.

pyenvでvirtualenvしててPILがインストール出来ない件

Last updated at Posted at 2014-07-31

下記情報は古くなっており、現状では実行出来ません。

詳しくはこちらをご参照下さいませ。
Pip | オープンデータとプログラミング

結局PILはもうpipでは入れられ無さそうです。

pipのどこかのバージョンから --allow-external--allow-unverifieddeprecated になったようです。

おとなしく pillow を使えって事ですよね。


pyenvで環境設定していて、pyenv local hogehogeしてて、pyenv activateしてるプロジェクトで、pip install PILがコケる訳ですよ。

更に二段仕掛けだったのでメモ

結論

  • pip install PIL --allow-external PIL --allow-unverified PIL で入れる
  • ln -s /usr/local/include/freetype2 /usr/local/include/freetype する

詳細

1つめの --allow-external の件

$ pip install PIL

てするとコケる

Downloading/unpacking PIL
  Could not find any downloads that satisfy the requirement PIL
  Some insecure and unverifiable files were ignored (use --allow-unverified PIL to allow).
Cleaning up...
No distributions at all found for PIL
Storing debug log for failure in /Users/jasper/.pip/pip.log

ググる

ここに書いてあった
http://stackoverflow.com/questions/21242107/pip-install-pil-dont-install-into-virtualenv

pip install PIL --allow-external PIL --allow-unverified PIL

ってやったらなにやらまえと違う感じになった

2つめのfreetypeの件

pip install PIL --allow-external PIL --allow-unverified PIL

で進展したのはいいけどまだインストール出来ない

building '_imagingft' extension

gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/usr/local/include/freetype2 -IlibImaging -I/usr/local/opt/pyenv/versions/inblue/include -I/usr/local/include -I/usr/include -I/usr/local/opt/pyenv/versions/2.6.8/include/python2.6 -c _imagingft.c -o build/temp.macosx-10.4-x86_64-2.6/_imagingft.o

_imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found

#include <freetype/fterrors.h>

         ^

1 error generated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/local/opt/pyenv/versions/inblue/bin/python -c "import setuptools, tokenize;__file__='/usr/local/var/lib/pyenv/versions/inblue/build/PIL/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('
', '
'), __file__, 'exec'))" install --record /var/folders/10/1gcb6yqd4m14g9qr7s0lztg40000gn/T/pip-0bcmkN-record/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/opt/pyenv/versions/inblue/include/site/python2.6 failed with error code 1 in /usr/local/var/lib/pyenv/versions/inblue/build/PIL
Storing debug log for failure in /Users/jasper/.pip/pip.log

わかんない。ググる

これに当たるけど違う。Pillowを入れろって。
http://stackoverflow.com/questions/23996756/pil-installation-error-on-mac-os-maverics-inside-virtual-env

俺が入れたいのはPILなんだっ

さらにググる

それっぽいのに当たる。
http://stackoverflow.com/questions/20325473/error-installing-python-image-library-using-pip-on-mac-os-x-10-9

シンボリックリンク貼ってるだけだし、リンク先のファイルは無かったから、やっただけなら戻せるだろうと思いまして。

ln -s /usr/local/include/freetype2 /usr/local/include/freetype

はい。インストール成功。

pip install PIL --allow-external PIL --allow-unverified PIL


2014/11/20 追記:
@shitsyndrome さんからコメント頂きまして原因が発覚しました。

pipの1.5からはデフォルトの挙動がかわっていて、外部ホスト(pypi.python.org以外)からのダウンロードを行いたい場合は明示的に指定する必要があるみたいです。
http://pip.readthedocs.org/en/latest/reference/pip_install.html#externally-hosted-files

31
32
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31
32