ubuntu 14.04 python2.7.9 缺少zlib模块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu 14.04 python2.7.9 缺少zlib模块相关的知识,希望对你有一定的参考价值。

ubuntu 14.04的系统开始python是2.7.3的然后我手动升级到2.7.9,之后在使用过程中出现缺少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

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

进行到重新编译python源码文件步骤,可是怎么也找不到python源码里的configure文件!!求大神帮忙啊!!!谢谢了!

参考技术A 就到2.7.9啦

如何配置ubuntu python

参考技术A 1.Python下载

Python下载

地址: http://www.python.org/getit/

版本: Python-2.7.3.tgz

setuptoos下载

地址:http://pypi.python.org/pypi/setuptools#downloads

版本:setuptools-0.6c11.tar.gz(md5)

采用wget方式下载:
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e

2.安装Python

查看系统自带的python:

计划安装2.7.3,新建目录--下载安装包:

解压
tar -zvxf Python-2.7.3.tgz

解压后,安装Python:

./configure --prefix=/usr/local/python2.7.3
make
make install

安装成功后目录为:

建立软链接:

3.安装setuptools

采用wget下载:
[root@biao Python-2.7.3]# pwd
/python/Python-2.7.3
[root@biao Python-2.7.3]# cd ..
[root@biao python]# ll
total 13832
drwxr-x--- 18 1000 1002 4096 Dec 5 18:05 Python-2.7.3
-rwxr-xr-x 1 root root 14135620 Dec 5 17:42 Python-2.7.3.tgz
[root@biao python]# wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
--18:18:59-- http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
Resolving pypi.python.org... 140.211.10.73
Connecting to pypi.python.org|140.211.10.73|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 256862 (251K) [application/octet-stream]
Saving to: `setuptools-0.6c11.tar.gz'
100%[======================================================================] 256,862 126K/s in 2.0s 18:19:25 (126 KB/s) - `setuptools-0.6c11.tar.gz' saved [256862/256862]

图片贴起来有点烦,请自行查看http://www.linuxprobe.com/python2-7-install.html这篇技术文章吧。。

以上是关于ubuntu 14.04 python2.7.9 缺少zlib模块的主要内容,如果未能解决你的问题,请参考以下文章

python2.7.9基础学习

centos下安装python2.7.9和pip1.5.5

python2.7.9安装mysql-python模块

Python2.7.9安装setuptools-0.6c11出错

(32)odoo中的编码问题

用python2.7.9 写个小程序搜索某个目录下行有某关键字