作者:1凡evan | 来源:互联网 | 2023-05-18 20:05
zlib模块安装先去http:www.zlib.net下载最新版本的zlib源码文件安装zlib:[]#tarxzvfzlib-1.2.8.tar.gz[]#c
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了。