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了。