还是年轻啊~仅仅用pip install PIL
是不行的,有很大几率会出现:
1.pip找不到包
2.#include <freetype/fterrors.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
解决方法嘛……
ln -s /usr/local/include/freetype2 /usr/local/include/freetype
pip2.7 install PIL --allow-external PIL --allow-unverified PIL
Downloading/unpacking PIL
之后出现什么都不用管,直接进入python目录下的site-packages里找到PIL文件夹,出现这个文件夹即可,最后进入pydev在偏好设置里把这个文件夹引入即可。
测试一个图片,代码:
import os