Python2.7.3的No module named zlib错误

Python2.7.3的No module named zlib错误

CentOS5.8上的python是2.4,没有multiprocessing模块
于是加入epel源,装了源里面的最新的python,python2.6,感觉挺好的
然后某天,报错没有argparse模块
于是,源码编译python2.7,但是报错没有paramiko模块
于是下载了paramiko模块装上
再次报没有pycrypto模块
我再下载pycrypto模块装上
再import paramiko,说没有zlib模块
[root@cclove ~]# python27
Python 2.7.3 (default, Sep 30 2012, 02:06:00)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
/cclove/python27/lib/python2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cclove/python27/lib/python2.7/site-packages/paramiko/__init__.py", line 62, in <module>
    from transport import SecurityOptions, Transport
  File "/cclove/python27/lib/python2.7/site-packages/paramiko/transport.py", line 37, in <module>
    from paramiko.compress import ZlibCompressor, ZlibDecompressor
  File "/cclove/python27/lib/python2.7/site-packages/paramiko/compress.py", line 23, in <module>
    import zlib
ImportError: No module named zlib
>>>

找了好久,没有python的zlib模块下载
find了一下系统的zlib,找到了python2.7.3的源码目录里面有zlib的源文件
于是再看了一下configure
于是configure的时候带上--with-zlib参数
再次编译,再次装上paramiko模块和pycrypto
这次没报少模块了
但是它报GMP太老
[root@cclove ~]# python27
Python 2.7.3 (default, Nov 24 2012, 02:51:19)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
/cclove/python27/lib/python2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
>>>

于是我用源码更新了GMP
重新编译python2.7.3,重新撞了paramiko模块和pycrypto
还是报GMP太老
于是再次回到python2.6
下载了argparse模块在python2.6上装
但是报错说没有setuptools模块
于是下载了setuptools模块,装上
再次装上argparse模块
这下,好了,神马都好了
[root@cclove ~]# python26
Python 2.6.8 (unknown, Apr 12 2012, 20:59:36)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
>>> import paramiko

啊,脑袋短路不好玩啊,早这么干不就好了啊


本文链接: http://phey.cc/No_module_name_zlib_in_python2_7_3.html

你可能感兴趣的:(python2.7)