Created
November 23, 2011 20:07
-
-
Save pbreit/1389747 to your computer and use it in GitHub Desktop.
Install PIL in MacOS Lion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#attempt to install PIL on MacOS Lion | |
#without Fink, brew, MacPorts, etc | |
#install Xcode 4.2.1 | |
#this might be necessary | |
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes | |
#delete previous attempts (optional) | |
cd /usr/loca/bin | |
sudo rm -rf *jpeg* | |
sudo rm -rf *jpg* | |
cd /usr/loca/include | |
sudo rm jconfig.h | |
sudo rm jerror.h | |
sudo rm jmorecfg.h | |
sudo rm jpeglib.h | |
cd /usr/loca/lib | |
sudo rm -rf libjpeg* | |
cd /usr/local/share/man/man1/ | |
sudo rm -rf *jpeg* | |
sudo rm -rf *jpg* | |
#might also be necessary to delete files in /opt | |
cd /opt/local/bin | |
sudo rm -rf *jpeg* | |
sudo rm -rf *jpg* | |
cd /opt/loca/include | |
sudo rm jconfig.h | |
sudo rm jerror.h | |
sudo rm jmorecfg.h | |
sudo rm jpeglib.h | |
cd /opt/loca/lib | |
sudo rm -rf libjpeg* | |
cd /opt/local/share/man/man1/ | |
sudo rm -rf *jpeg* | |
sudo rm -rf *jpg* | |
#jpeg install | |
curl -O http://www.ijg.org/files/jpegsrc.v8c.tar.gz | |
tar -zxvf jpegsrc.v8c.tar.gz | |
cd jpeg-8c | |
./configure | |
sudo make clean | |
sudo CC="gcc -arch i386" ./configure –enable-shared –enable-static | |
sudo make | |
sudo make install | |
#PIL install | |
curl -O http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz | |
tar -zxvf Imaging-1.1.7.tar.gz | |
cd Imaging-1.1.7 | |
#edit following line in setup.py; may need 'lib' | |
#JPEG_ROOT = libinclude("/usr/local") | |
#JPEG_ROOT = libinclude("/usr/local/lib") | |
sudo python setup.py build | |
sudo python setup.py install | |
#test; should not see any errors | |
python | |
>>>import PIL | |
>>>import Image | |
>>>import _imaging | |
#possibly easier way to install PIL | |
#ARCHFLAGS="-arch i386 -arch x86_64" sudo pip install PIL | |
#sources | |
#http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/ | |
#http://mtrichardson.com/2009/11/pil-libjpeg-snow-leopard-and-missing-_jpeg_resync_to_restart/ | |
#may be able to simply use these binaries | |
#http://old.nabble.com/Re:-building-PIL-in-Snow-Leopard-p28938239.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment