我已经在我的ubuntu lucid上编译并安装了python 2.7 但我无法为python 2.7安装setuptools,因为数据解压缩模块zlib不存在。这是确切的错误:
Traceback (most recent call last):
File "setup.py", line 94, in <module>
scripts = scripts,
File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/rohan/setuptools-0.6c11/setuptools/command/install.py", line 76, in run
self.do_egg_install()
File "/home/rohan/setuptools-0.6c11/setuptools/command/install.py", line 96, in do_egg_install
self.run_command('bdist_egg')
File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/rohan/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 236, in run
dry_run=self.dry_run, mode=self.gen_header())
File "/home/rohan/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 527, in make_zipfile
z = zipfile.ZipFile(zip_filename, mode, compression=compression)
File "/usr/local/lib/python2.7/zipfile.py", line 651, in __init__
"Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module
此外,当我尝试使用setuptools 2.7 .egg时,它会出现此错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
zipimport.ZipImportError: can't decompress data; zlib not available
答案 0 :(得分:34)
在构建Python之前忘了安装zlib1g-dev
。
答案 1 :(得分:8)
首先使用以下命令安装companents
yum install zlib
yum install zlib-devel
然后重制python
make
make install
答案 2 :(得分:5)
请在继续之前安装。
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev\
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev
答案 3 :(得分:1)
我对这个问题的解决方案略有不同只是因为我试图在远程计算机上安装python,我无法以root用户身份访问并且无法访问互联网。这是我稍加修改的解决方案:
这对每个人都不适用,但它今天对我有用。
答案 4 :(得分:1)
对于debian
document.all
然后在您的python文件夹中运行
sudo apt-get install zlib1g-dev