Because there is a need for image analysis in the collection, now that the crawler architecture is deployed in docker, it is necessary to configure an image package in PIL, due to many errors. So record it.
The main reference links are:
http://www.linuxdiyf.com/linux/18829.html
http://www.linuxdiyf.com/linux/18576.html
PIL installation
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/`uname -i`-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib
or
sudo apt-get build-dep python-imaging
Since the header file of libfreetype in ubuntu14 is in the /usr/include/freetype2 directory, but the path used in PIL is freetype, you need to do the following
cd /usr/include
ln -s freetype2 freetype
Install PIL library
$:wget wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
$:tar -zxvf Imaging-1.1.7
$:cd Imageing-1.1.7
Modify setup.py
JPEG_ROOT ="/usr/local/lib"
ZLIB_ROOT ="/usr/local/lib"
FREETYPE_ROOT ="/usr/local/lib"
Check whether the system environment is successfully configured:
$:cd Imaging-1.1.7
$:python setup.py build_ext -i
running build_ext
———————————————–
PIL 1.1.7 SETUP SUMMARY
———————————————–
version 1.1.7
platform linux2 2.7.6 (default, Jun 22 2015, 17:58:13)
[ GCC 4.8.2]
———————————————–
*** TKINTER support not available (Tcl/Tk 8.6 libraries needed)
— JPEG support available
— ZLIB (PNG/ZIP) support available
— FREETYPE2 support available
*** LITTLECMS support not available
———————————————–
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
As long as JPEG, ZLIB, FREETYPE2 are available
Start the installation of PIL:
python setup.py build
(My error<freetype/freetype>does not exist,Approach:cd /usr/include sudo ln -s freetype2 freetype)
python setup.py install
***Original article, please indicate: ** Reprinted from *URl-team
The link to this article:docker ubuntu: install python-PIL-image environment on 14.04
Recommended Posts