Python安装zlib模块

zlib模块安装


先去http://www.zlib.net/下载最新版本的zlib源码文件 安装zlib: []#tar xzvf zlib-1.2.8.tar.gz []#cd zlib-1.2.8 []#./configure []#make []#make install zlib安装完后,libz.a在/usr/local/lib/,zlib.h文件在/usr/include (opensuse中zlib.h默认放在/usr/local/include/中)

重新编译python


进入Python源码文件目录,重新编译Python []#./configure –prefix=/home/program/python3 –with-zlib=/usr/include []#./configure –prefix=/home/program/python3 –with-zlib-dir=/usr/local/lib 都可以完成python对zlib库的支持,在python源码中直接import zlib即可使用zlib了。