How to install PIL with pip on Mac OS?
Solution 1:
- Install Xcode and Xcode Command Line Tools as mentioned.
- Use Pillow instead, as PIL is basically dead. Pillow is a maintained fork of PIL.
https://pypi.org/project/Pillow/
pip install Pillow
If you have both Pythons installed and want to install this for Python3:
python3 -m pip install Pillow
Solution 2:
This works for me:
apt-get install python-dev
apt-get install libjpeg-dev
apt-get install libjpeg8-dev
apt-get install libpng3
apt-get install libfreetype6-dev
ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib
pip install PIL --allow-unverified PIL --allow-all-external
Solution 3:
It is very simple using apt install use this command to get it done
sudo apt-get install python-PIL
or
sudo pip install pillow
or
sudo easy_install pillow
Solution 4:
Install
pip install Pillow
Then, Just import in your file like,
from PIL import Image
I am using windows. It is working for me.
NOTE:
Pillow is a functional drop-in replacement for the Python Imaging Library. To run your existing PIL-compatible code with Pillow, it needs to be modified to import the Imaging module from the PIL namespace instead of the global namespace.
i.e. change:
import Image
to:
from PIL import Image
https://pypi.org/project/Pillow/2.2.1/