2021-05-12 14:32:11
Python安裝setuptools時報Compression requires the (missing) zlib module錯誤解決
背景: 虛擬機器CentOS下安裝Python輔助工具 setuptools報錯,錯誤資訊大概如下:
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 "/opt/Oracle/sor/install/setuptools-0.6c11/setuptools/command/install.py", line 76, in run
self.do_egg_install()
File "/opt/oracle/sor/install/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 "/opt/oracle/sor/install/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 236, in run
dry_run=self.dry_run, mode=self.gen_header())
File "/opt/oracle/sor/install/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 681, in __init__
"Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module
出錯原因:
提示的很清楚,缺少 zlib模組導致安裝失敗
解決方式:
# yum install zlib
# yum install zlib-devel
下載成功後,進入python2.7的目錄,重新執行
#make
#make install
此時先前執行的 軟連線仍舊生效
然後進入 setuptool目錄,
[root@localhost setuptools-5.2]# pythonnew setup.py install 重新安裝
基本這樣就可以搞定。
本文永久更新連結地址:http://www.linuxidc.com/Linux/2017-02/140234.htm
相關文章