首页 > Python编程 > python 安装 setuptools Compression requires the (missing) zlib module 的解决方案

python 安装 setuptools Compression requires the (missing) zlib module 的解决方案

2014年12月15日

python 安装 setuptools Compression requires the (missing) zlib module 的解决方案
http://chengjianxiaoxue.iteye.com/blog/2095012
背景: 虚拟机centos下安装python辅助工具 setuptools报错,错误信息大概如下:
Java代码 复制代码 收藏代码
1.Traceback (most recent call last):
2. File “setup.py”, line 94, in <module>
3. scripts = scripts,
4. File “/usr/local/lib/python2.7/distutils/core.py”, line 152, in setup
5. dist.run_commands()
6. File “/usr/local/lib/python2.7/distutils/dist.py”, line 953, in run_commands
7. self.run_command(cmd)
8. File “/usr/local/lib/python2.7/distutils/dist.py”, line 972, in run_command
9. cmd_obj.run()
10. File “/opt/oracle/sor/install/setuptools-0.6c11/setuptools/command/install.py”, line 76, in run
11. self.do_egg_install()
12. File “/opt/oracle/sor/install/setuptools-0.6c11/setuptools/command/install.py”, line 96, in do_egg_install
13. self.run_command(‘bdist_egg’)
14. File “/usr/local/lib/python2.7/distutils/cmd.py”, line 326, in run_command
15. self.distribution.run_command(command)
16. File “/usr/local/lib/python2.7/distutils/dist.py”, line 972, in run_command
17. cmd_obj.run()
18. File “/opt/oracle/sor/install/setuptools-0.6c11/setuptools/command/bdist_egg.py”, line 236, in run
19. dry_run=self.dry_run, mode=self.gen_header())
20. File “/opt/oracle/sor/install/setuptools-0.6c11/setuptools/command/bdist_egg.py”, line 527, in make_zipfile
21. z = zipfile.ZipFile(zip_filename, mode, compression=compression)
22. File “/usr/local/lib/python2.7/zipfile.py”, line 681, in __init__
23. “Compression requires the (missing) zlib module”
24.
25.
26.<strong>RuntimeError: Compression requires the (missing) zlib module
27.</strong>

出错原因:

提示的很清楚,缺少 zlib模块导致安装失败

处理方式:
Java代码 复制代码 收藏代码
1.# yum install zlib
2.# yum install zlib-devel
3.下载成功后,进入python2.7的目录,重新执行
4.#make
5.#make install
6.
7.此时先前执行的 软连接仍旧生效
8.
9.然后进入 setuptool目录,
10.[root@localhost setuptools-5.2]# pythonnew setup.py install 重新安装

基本这样就可以搞定

分类: Python编程 标签:
本文的评论功能被关闭了.